Download the PHP package nadar/php-composer-reader without Composer
On this page you can find all versions of the php package nadar/php-composer-reader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nadar/php-composer-reader
More information about nadar/php-composer-reader
Files in nadar/php-composer-reader
Package php-composer-reader
Short Description Read and manipulate composer.json
License MIT
Informations about the package php-composer-reader
Composer JSON Reader and Manipulator
A small PHP library for manipulating and reading the composer.json file. It allows you to add new sections, check if it's writable/readable, or retrieve information from the composer schema such as description, title, and more.
Installation
Install via Composer:
Usage
To load the composer.json file into ComposerReader:
Reading Section Data
Retrieve an array of objects for each package in the require
section of the composer.json file:
Retrieve an array of objects for each PSR definition in the autoload
section of the composer.json file:
The following section readers are available for the composer schema (Composer Schema Documentation):
Section | Class |
---|---|
require |
RequireSection |
require-dev |
RequireDevSection |
autoload |
AutoloadSection |
autoload-dev |
AutoloadDevSection |
Additional schema information can be retrieved from the ComposerReader object with: $reader->contentSection('extra', null);
Changing Section Data
Add a new PSR autoload definition to an existing composer.json file and save it:
Running Commands
To perform composer operations, use the runCommand()
method:
This attempts to execute the dump-autoload command for the specified composer.json file. This requires a globally installed Composer command on your system (Install Composer globally).