Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe InstalledVersions

Fonctions membres publiques statiques

static getInstalledPackages ()
 
static getInstalledPackagesByType ($type)
 
static isInstalled ($packageName, $includeDevRequirements=true)
 
static satisfies (VersionParser $parser, $packageName, $constraint)
 
static getVersionRanges ($packageName)
 
static getVersion ($packageName)
 
static getPrettyVersion ($packageName)
 
static getReference ($packageName)
 
static getInstallPath ($packageName)
 
static getRootPackage ()
 
static getRawData ()
 
static getAllRawData ()
 
static reload ($data)
 

Fonctions membres privées statiques

static getInstalled ()
 

Attributs privés statiques

static $installed
 
static $canGetVendors
 
static $installedByVendor = array()
 

Description détaillée

This class is copied in every Composer installed project and available to all

See also https://getcomposer.org/doc/07-runtime.md#installed-versions

To require its presence, you can require composer-runtime-api ^2.0

Documentation des fonctions membres

◆ getAllRawData()

static getAllRawData ( )
static

Returns the raw data of all installed.php which are currently loaded for custom implementations

Renvoie
array[] -return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>

◆ getInstalled()

static getInstalled ( )
staticprivate
Renvoie
array[] -return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>

Références $loader, $vendorDir, elseif, et null.

◆ getInstalledPackages()

static getInstalledPackages ( )
static

Returns a list of all package names which are present, either by being installed, replaced or provided

Renvoie
string[] -return list<string>

◆ getInstalledPackagesByType()

static getInstalledPackagesByType (   $type)
static

Returns a list of all package names with a specific type e.g. 'library'

Paramètres
string$type
Renvoie
string[] -return list<string>

Références $name, et $type.

◆ getInstallPath()

static getInstallPath (   $packageName)
static
Paramètres
string$packageName
Renvoie
string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.

Références null.

◆ getPrettyVersion()

static getPrettyVersion (   $packageName)
static
Paramètres
string$packageName
Renvoie
string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present

Références null.

◆ getRawData()

static getRawData ( )
static

Returns the raw installed.php data for custom implementations

Obsolète:
Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
Renvoie
array[] -return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}

Références null.

◆ getReference()

static getReference (   $packageName)
static
Paramètres
string$packageName
Renvoie
string|null If the package is being replaced or provided but is not really installed, null will be returned as reference

Références null.

◆ getRootPackage()

static getRootPackage ( )
static
Renvoie
array -return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}

◆ getVersion()

static getVersion (   $packageName)
static
Paramètres
string$packageName
Renvoie
string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present

Références null.

◆ getVersionRanges()

static getVersionRanges (   $packageName)
static

Returns a version constraint representing all the range(s) which are installed for a given package

It is easier to use this via isInstalled() with the $constraint argument if you need to check whether a given version of a package is installed, and not just whether it exists

Paramètres
string$packageName
Renvoie
string Version constraint usable with composer/semver

◆ isInstalled()

static isInstalled (   $packageName,
  $includeDevRequirements = true 
)
static

Checks whether the given package is installed

This also returns true if the package name is provided or replaced by another package

Paramètres
string$packageName
bool$includeDevRequirements
Renvoie
bool

◆ reload()

static reload (   $data)
static

Lets you reload the static array from another file

This is only useful for complex integrations in which a project needs to use this class but then also needs to execute another project's autoloader in process, and wants to ensure both projects have access to their version of installed.php.

A typical case would be PHPUnit, where it would need to make sure it reads all the data it needs from this class, then call reload() with require $CWD/vendor/composer/installed.php (or similar) as input to make sure the project in which it runs can then also use this class safely, without interference between PHPUnit's dependencies and the project's dependencies.

Paramètres
array[]$data A vendor/composer/installed.php data set
Renvoie
void

-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data

Références $data.

◆ satisfies()

static satisfies ( VersionParser  $parser,
  $packageName,
  $constraint 
)
static

Checks whether the given package satisfies a version constraint

e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:

Composer::satisfies(new VersionParser, 'foo/bar', '^2.3')

Paramètres
VersionParser$parserInstall composer/semver to have access to this class and functionality
string$packageName
string | null$constraintA version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
Renvoie
bool

Documentation des champs

◆ $canGetVendors

$canGetVendors
staticprivate

◆ $installed

$installed
staticprivate

◆ $installedByVendor

$installedByVendor = array()
staticprivate

La documentation de cette classe a été générée à partir du fichier suivant :