class DrupalCoreComposer (View source)

Utilities for accessing composer.json data from drupal/drupal and drupal/core.

Some data is stored in the root composer.json file, while others is found in the core/composer.json file.

Properties

protected array $composerJson

Cached composer.json data.

protected array $composerLock

Cached composer.lock data.

Methods

__construct(array $composerJson, array $composerLock)

DrupalCoreComposer constructor.

createFromPath(string $repositoryPath)

DrupalCoreComposer factory.

array
rootComposerJson()

Fetch the composer data from the root drupal/drupal project.

array
composerLock()

Fetch the composer lock data.

array
getRequireDev()

Return the "require-dev" section from root or core composer.json file.

array
packageLockInfo(string $packageName, bool $dev = FALSE)

Look up the info for one package in the composer.lock file.

static array
loadJsonFromPath(string $path)

Load json data from the specified path.

Details

__construct(array $composerJson, array $composerLock)

DrupalCoreComposer constructor.

Parameters

array $composerJson

The composer.json data.

array $composerLock

The composer.lock data.

static DrupalCoreComposer createFromPath(string $repositoryPath)

DrupalCoreComposer factory.

Parameters

string $repositoryPath

Path to a directory containing a composer.json and composer.lock files.

Return Value

DrupalCoreComposer

New DrupalCoreComposer object containing composer.json and lock data.

array rootComposerJson()

Fetch the composer data from the root drupal/drupal project.

Return Value

array

Composer json data

array composerLock()

Fetch the composer lock data.

Return Value

array

Composer lock data

array getRequireDev()

Return the "require-dev" section from root or core composer.json file.

The require-dev constraints moved from core/composer.json (8.7.x and earlier) to the root composer.json file (8.8.x and later).

Return Value

array

The contents of the "require-dev" section.

array packageLockInfo(string $packageName, bool $dev = FALSE)

Look up the info for one package in the composer.lock file.

Parameters

string $packageName

Name of package to find, e.g. 'behat/mink-selenium2-driver'.

bool $dev

TRUE: consider only 'packages-dev'. Default: consider only 'packages'

Return Value

array

Package info from composer.lock.

static protected array loadJsonFromPath(string $path)

Load json data from the specified path.

Parameters

string $path

Relative path to the json file to load.

Return Value

array

The contents of the json data for the specified file.