function ComposerInspector::getRootPackageInfo

Returns the output of `composer show --self` in a directory.

Parameters

string $working_dir: The directory in which to run Composer.

Return value

array The parsed output of `composer show --self`.

File

core/modules/package_manager/src/ComposerInspector.php, line 376

Class

ComposerInspector
Defines a class to get information from Composer.

Namespace

Drupal\package_manager

Code

public function getRootPackageInfo(string $working_dir) : array {
    $this->validate($working_dir);
    $this->runner
        ->run([
        'show',
        '--self',
        '--format=json',
        "--working-dir={$working_dir}",
    ], callback: $this->processCallback
        ->reset());
    return $this->processCallback
        ->parseJsonOutput();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.