silvanite / composer-reader
Read composer.json files using a fluent api.
v1.0.1
2018-11-18 20:42 UTC
Requires
- php: ^7.0.0
Requires (Dev)
- squizlabs/php_codesniffer: ^3.3.0
This package is not auto-updated.
Last update: 2024-11-13 04:01:07 UTC
README
Read composer.json files using a fluent api.
Installation
composer require silvanite/composer-reader
Usage
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');
Support
If you require any support please contact me on Twitter or open an issue on this repository.
License
MIT