Read composer.json files using a fluent api.
composer require silvanite/composer-reader
Check if a package is installed. Defaults to look for composer.json
in the current working directory.
$installed = Composer::read()->has('my/package');
If the file is in a different location, specify the filename.
$installed = Composer::read('./path/to/composer.json')->has('my/package');
The require section is checked by default, but you can define which section to check
$installed = Composer::read()->require()->has('my/package');
$installedDev = Composer::read()->requireDev()->has('my/package');
Check the required version of a package. Will return the full version string.
$version = Composer::read()->version('my/package');
If you require any support please contact me on Twitter or open an issue on this repository.
MIT