Giter VIP home page Giter VIP logo

composer-config-reader's Introduction

Composer configuration reader

A light-weight component for reading Composer configuration files.

[![The most recent stable version is 2.0.0][version-image]][Semantic versioning] [![Current build status image][build-image]][Current build status] [![Current coverage status image][coverage-image]][Current coverage status]

Installation and documentation

  • Available as [Composer] package [eloquent/composer-config-reader].
  • [API documentation] available.

Usage

Composer configuration reader is very simple to use, and a quick example should be self-explanatory:

$reader = new Eloquent\Composer\Configuration\ConfigurationReader;
$configuration = $reader->read('/path/to/composer.json');

echo $configuration->name(); // outputs the package name
```

## Configuration objects

The following are the objects used to represent the configuration information.
For a more detailed overview of the data available, simply look through the
class definition (these classes are very simple).

The following classes all exist in the `Eloquent\Composer\Configuration\Element`
namespace.

### [Configuration]

This is the main configuration object and has methods to access all the
information available in the [Composer schema].

#### Example methods

* `name()`: The package name.
* `description()`: The package description.
* `dependencies()`: Equivalent to Composer `require`.
* `devDependencies()`: Equivalent to Composer `require-dev`.
* `autoloadPSR0()`: The autoload information for PSR-0 namespaces/paths.
* `autoloadClassmap()`: The autoload information for classmapped paths.

#### Helper methods

A number of helper methods exist on the main configuration object to simplify
the process of extracting useful information:

* `projectName()`: The project name without the vendor prefix.
* `vendorName()`: The vendor name without the project suffix.
* `allDependencies()`: Combines `require` and `require-dev` into a single array.
* `allPSR0SourcePaths()`: A flat array of all PSR-0-compliant source paths.
* `allSourcePaths()`: A flat array of all source paths.

### [Repository], [PackageRepository]

These objects describe the package's defined repositories.

All repositories are represented by the `Repository` class, except for
package-type repositories which use the `PackageRepository` class.

See [Repositories].

#### Example methods

* `type()`: The repository type.
* `url()`: The repository URL (not available for `PackageRepository`).

### [Stability]

This object is an [enumeration] of package stabilities, with the following
members:

* DEV
* ALPHA
* BETA
* RC
* STABLE

It is currently only used to represent the value of the [minimum-stability]
option.

### [Author]

This object contains all information provided for a specific author.

See [authors].

#### Example methods

* `name()`: The author's name.
* `email()`: The author's email address.

### [SupportInformation]

This object describes the package's support contact information.

See [support].

#### Example methods

* `email()`: The support email address.
* `issues()`: The URL of the issue tracking system.
* `wiki()`: The URL of the wiki system.

### [ProjectConfiguration]

This object describes configuration options specific to end-projects, such as
the target directories for various resources provided by Composer.

See [config].

#### Example methods

* `vendorDir()`: The project's vendor directory path.
* `binDir()`: The project's binary directory path.

### [ScriptConfiguration]

This object describes the Composer scripts defined by the package.

See [Scripts].

#### Example methods

* `preInstallCmd()`: The pre-install scripts.
* `postInstallCmd()`: The post-install scripts.

### [ArchiveConfiguration]

This object describes the settings for creating package archives.

See [archive].

#### Example methods

* `exclude()`: A list of file exclusion patterns.

<!-- References -->

[archive]: http://getcomposer.org/doc/04-schema.md#archive
[ArchiveConfiguration]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/ArchiveConfiguration.html
[Author]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/Author.html
[authors]: http://getcomposer.org/doc/04-schema.md#authors
[Composer schema]: http://getcomposer.org/doc/04-schema.md
[config]: http://getcomposer.org/doc/04-schema.md#config
[Configuration]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/Configuration.html
[enumeration]: https://github.com/eloquent/enumeration
[minimum-stability]: http://getcomposer.org/doc/04-schema.md#minimum-stability
[PackageRepository]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/PackageRepository.html
[ProjectConfiguration]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/ProjectConfiguration.html
[Repositories]: http://getcomposer.org/doc/05-repositories.md
[Repository]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/Repository.html
[ScriptConfiguration]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/ScriptConfiguration.html
[Scripts]: http://getcomposer.org/doc/articles/scripts.md
[Stability]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/Stability.html
[support]: http://getcomposer.org/doc/04-schema.md#support
[SupportInformation]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/Eloquent/Composer/Configuration/Element/SupportInformation.html

[API documentation]: http://lqnt.co/composer-config-reader/artifacts/documentation/api/
[Composer]: http://getcomposer.org/
[build-image]: http://img.shields.io/travis/eloquent/composer-config-reader/develop.svg "Current build status for the develop branch"
[Current build status]: https://travis-ci.org/eloquent/composer-config-reader
[coverage-image]: http://img.shields.io/coveralls/eloquent/composer-config-reader/develop.svg "Current test coverage for the develop branch"
[Current coverage status]: https://coveralls.io/r/eloquent/composer-config-reader
[eloquent/composer-config-reader]: https://packagist.org/packages/eloquent/composer-config-reader
[Semantic versioning]: http://semver.org/
[version-image]: http://img.shields.io/:semver-2.0.0-brightgreen.svg "This project uses semantic versioning"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.