Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/silvanite/composer-reader
Read composer.json files using a fluent api.
https://github.com/silvanite/composer-reader
Last synced: 28 days ago
JSON representation
Read composer.json files using a fluent api.
- Host: GitHub
- URL: https://github.com/silvanite/composer-reader
- Owner: Silvanite
- License: mit
- Created: 2018-11-18T19:49:36.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-18T20:42:33.000Z (almost 6 years ago)
- Last Synced: 2024-04-17T23:46:01.256Z (7 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
```php
$installed = Composer::read()->has('my/package');
```If the file is in a different location, specify the filename.
```php
$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
```php
$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.
```php
$version = Composer::read()->version('my/package');
```## Support
If you require any support please contact me on [Twitter](https://twitter.com/m2de_io) or open an issue on this repository.
## License
MIT