MediaWiki
REL1_35
ComposerInstalled.php
Go to the documentation of this file.
1
<?php
2
9
class
ComposerInstalled
{
13
private
$contents
;
14
18
public
function
__construct
( $location ) {
19
$this->contents = json_decode( file_get_contents( $location ),
true
);
20
}
21
27
public
function
getInstalledDependencies
() {
28
// Composer version 2 provides the list of installed packages under the 'packages' key.
29
$contents
= $this->contents[
'packages'
] ??
$this->contents
;
30
31
$deps = [];
32
foreach
(
$contents
as $installed ) {
33
$deps[$installed[
'name'
]] = [
34
'version'
=>
ComposerJson::normalizeVersion
( $installed[
'version'
] ),
35
'type'
=> $installed[
'type'
],
36
'licenses'
=> $installed[
'license'
] ?? [],
37
'authors'
=> $installed[
'authors'
] ?? [],
38
'description'
=> $installed[
'description'
] ??
''
,
39
];
40
}
41
42
ksort( $deps );
43
return
$deps;
44
}
45
}
ComposerInstalled
Reads an installed.json file and provides accessors to get what is installed.
Definition
ComposerInstalled.php:9
ComposerInstalled\__construct
__construct( $location)
Definition
ComposerInstalled.php:18
ComposerInstalled\$contents
array[] $contents
Definition
ComposerInstalled.php:13
ComposerInstalled\getInstalledDependencies
getInstalledDependencies()
Dependencies currently installed according to installed.json.
Definition
ComposerInstalled.php:27
ComposerJson\normalizeVersion
static normalizeVersion( $version)
Strip a leading "v" from the version name.
Definition
ComposerJson.php:48
includes
libs
composer
ComposerInstalled.php
Generated on Sat Apr 6 2024 00:07:21 for MediaWiki by
1.9.8