ocramius/package-versions
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "ocramius/package-versions" is an efficient tool used to access version information of composer dependencies. It derives information from the composer.lock file which is regenerated during composer install or composer update. Beneficially, no IO occurs when calling it as it compiles the list of package versions during the composer's installation. The utility is especially useful when you want to generate assets, code, or artifacts computed from the current version of a specific dependency.
To utilize the "ocramius/package-versions" tool in PHP, you can initiate it through the composer by using the following command: composer require ocramius/package-versions
. For optimized loading and to prevent autoload I/O when accessing the PackageVersions\Versions
API, you can include additional code in your composer.json:
"config": {
"optimize-autoloader": true
}
If you're manually generating your autoloader via the CLI, use the --optimize
flag as follows: composer dump-autoload --optimize
. The package can be used within your code as follows:
$version = \PackageVersions\Versions::getVersion('ocramius/package-versions');
var_dump($version); // returns: 1.0.0@0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
For detailed information and complete documentation, visit the official GitHub page ocramius/package-versions. The repository's README file contains all the necessary details needed to successfully use this tool.