A Composer addon that provides efficient, zero-I/O access to installed PHP package version numbers.
PackageVersions is a Composer addon for PHP that provides a fast, programmatic way to retrieve the version numbers of installed packages. It reads version data from the `composer.lock` file generated during `composer install` or `composer update`, eliminating the need for expensive filesystem I/O at runtime. This is particularly useful for generating assets, code, or artifacts that depend on specific dependency versions.
PHP developers who need to access package version information within their application logic, especially those working on build processes, asset generation, or deployment tooling where runtime performance is critical.
Developers choose PackageVersions because it offers a unique zero-I/O approach to version lookup, which is significantly faster than checking package versions at runtime. Its tight integration with Composer and simple API make it a reliable and efficient solution for dependency version management.
:package: Composer addon to efficiently get installed packages' version numbers
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Eliminates filesystem access at runtime by compiling version data during composer install, ensuring high performance as highlighted in the README's purpose section.
Derives data directly from composer.lock, fitting seamlessly into standard Composer commands like install and update without additional setup.
Provides a single, easy-to-use method, getVersion(), for retrieving any package's version, as demonstrated in the code example with minimal code.
Designed to work best with Composer's optimized autoloader, reducing autoload overhead in live environments, as recommended in the installation notes.
Relies on a consistent composer.lock file; if the lock file is missing, outdated, or frequently changed, version data may be inaccurate or unavailable.
For optimal performance, users must enable Composer's optimized autoloader, which is not default and adds an extra configuration step, as admitted in the README.
Only provides version info for Composer-managed packages, limiting use in projects with mixed dependency sources or non-Composer tools.