VersionResolver
API reference › Debug › VersionResolver
Resolves human-readable Composer package versions for the debug UI.
Replaces Composer’s synthetic dev placeholders (22.0.9999999.9999999-dev, dev-master) with the package alias plus
the short Git reference, producing strings such as 22.x-dev @a1b2c3d or 2.0.45.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
forExtensions() static | Rewrites the version field of each entry with the friendly version, when resolvable. | VersionResolver |
forPackage() static | Returns a friendly version string for a Composer package. | VersionResolver |
yii() static | Returns the Yii framework version for the toolbar brand chip. | VersionResolver |
Method details
Section titled “Method details”forExtensions()
Section titled “forExtensions() ”public static function forExtensions(array<int|string, array{name?: string, version?: string, bootstrap?: string|array<string, mixed>, alias?: array<string, string>}> $extensions): array<int|string, array{name?: string, version?: string, bootstrap?: string|array<string, mixed>, alias?: array<string, string>}>Rewrites the version field of each entry with the friendly version, when resolvable.
Accepts the array shape produced by Yii::$app->extensions; [$packageName => ['name' => ..., 'version' => ...]]. Entries whose key is not a string (malformed registrations) or whose package cannot be resolved through
Composer are returned unchanged.
Parameters
| Parameter | Type | Description |
|---|---|---|
$extensions | array<int| | Extension map keyed by package name. |
Returns
array<int|string, array{name?: string, version?: string, bootstrap?: string|array<string, mixed>, alias?: array<string, string>}>: Extension map with version fields rewritten in place.
forPackage()
Section titled “forPackage() ”public static function forPackage(string $package): string|nullReturns a friendly version string for a Composer package.
Tagged releases are returned verbatim. Dev branches are augmented with the 7-character Git short hash so two builds of the same branch can be told apart.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | string | Composer package name (vendor/package). |
Returns
string|null: Friendly version, or null when the package is not installed or has no pretty version.
yii()
Section titled “yii() ”public static function yii(): stringReturns the Yii framework version for the toolbar brand chip.
Returns
string: Yii version label for the brand chip.