# Composer Reader
A simple `composer.json` file reader.
## Installation
You can install the package via Composer:
```bash
composer require ability/composer-reader
To read and parse a composer.json
file, you can use the Reader
class:
use Ability\ComposerReader\Reader;
$context = Reader::create('/path/to/composer.json');
The Context
class provides methods to access the data:
use Ability\ComposerReader\Context;
// Get a value by key
$value = $context->get('name');
// Check if a key exists
$exists = $context->has('require.php');
The Context
class implements ArrayAccess
, so you can use it like an array:
// Get a value by key
$value = $context['name'];
// Check if a key exists
$exists = isset($context['require.php']);
The Context
class implements JsonSerializable
, so you can easily convert it to JSON:
$json = json_encode($context);
- PHP >= 8.0
To contribute to this project, you can install the development dependencies:
composer install
The MIT License (MIT). Please see License File for more information.
- Roman Zhakhov [email protected]