class Composer (View source)

Provides static functions for composer script events. See also core/lib/Drupal/Composer/Composer.php, which contains similar scripts needed by projects that include drupal/core. Scripts that are only needed by drupal/drupal go here.

Methods

static void
generateMetapackages(Event $event)

Update metapackages whenever composer.lock is updated.

static void
setDrupalVersion(string $root, string $version)

Set the version of Drupal; used in release process and by the test suite.

static void
setTemplateProjectStability(string $root, string $version)

Set the stability of the template projects to match the Drupal version.

static void
ensureComposerVersion()

Ensure that the minimum required version of Composer is running.

static string
drupalVersionBranch()

Return the branch name the current Drupal version is associated with.

static Finder
composerSubprojectPaths(string $root, string $subprojectType)

Return the list of subprojects of a given type.

Details

static void generateMetapackages(Event $event)

Update metapackages whenever composer.lock is updated.

Parameters

Event $event

The Composer event.

Return Value

void

static void setDrupalVersion(string $root, string $version)

Set the version of Drupal; used in release process and by the test suite.

Parameters

string $root

Path to root of drupal/drupal repository.

string $version

Semver version to set Drupal's version to.

Return Value

void

Stability level of the provided version (stable, RC, alpha, etc.)

Exceptions

UnexpectedValueException

static protected void setTemplateProjectStability(string $root, string $version)

Set the stability of the template projects to match the Drupal version.

Parameters

string $root

Path to root of drupal/drupal repository.

string $version

Semver version that Drupal was set to.

Return Value

void

Stability level of the provided version (stable, RC, alpha, etc.)

static void ensureComposerVersion()

Ensure that the minimum required version of Composer is running.

Throw an exception if Composer is too old.

Return Value

void

static string drupalVersionBranch()

Return the branch name the current Drupal version is associated with.

Return Value

string

A branch name, e.g. 8.9.x or 9.0.x.

static Finder composerSubprojectPaths(string $root, string $subprojectType)

Return the list of subprojects of a given type.

Parameters

string $root

Path to root of drupal/drupal repository.

string $subprojectType

Type of subproject - one of Metapackage, Plugin, or Template

Return Value

Finder