Skip to content

Silvanite/composer-reader

Repository files navigation

Composer Reader

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

About

Read composer.json files using a fluent api.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages