2017 © Pedro Peláez
 

library composed

Easily parse your project's Composer configuration, and those of its dependencies, at runtime.

image

joshdifabio/composed

Easily parse your project's Composer configuration, and those of its dependencies, at runtime.

  • Monday, November 14, 2016
  • by joshdifabio
  • Repository
  • 2 Watchers
  • 31 Stars
  • 23,407 Installations
  • PHP
  • 5 Dependents
  • 1 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 16 % Grown

The README.md

Composed

Code Quality, (*1)

This library provides a set of utility functions designed to help you parse your project's Composer configuration, and those of its dependencies, at runtime., (*2)

Usage

The API combines functional and object-oriented approaches., (*3)

Locate the vendor directory

(Chicken and egg...), (*4)

$absoluteVendorPath = Composed\VENDOR_DIR;

Locate the project's base directory

$absoluteProjectPath = Composed\BASE_DIR;

Get the authors of a specific package

You can fetch data from the composer.json file of a specific package., (*5)

$authors = Composed\package_config('phpunit/phpunit', 'authors');

assert($authors === [
    [
        'name' => "Sebastian Bergmann",
        'email' => "sebastian@phpunit.de",
        'role' => "lead",
    ],
]);

Get licenses of all installed packages

You can fetch data from all composer.json files in your project in one go., (*6)

$licenses = Composed\package_configs('license');

assert($licenses === [
  'joshdifabio/composed' => "MIT",
  'doctrine/instantiator' => "MIT",
  'phpunit/php-code-coverage' => "BSD-3-Clause",
]);

Get the absolute path to a file in a package

$path = Composed\package('phpunit/phpunit')->getPath('composer.json');

Get all packages installed on your project

foreach (Composed\packages() as $packageName => $package) {
    $pathToPackageConfig = $package->getPath('composer.json');
    // ...
}

Get data from your project's Composer config

You can also fetch data from the composer.json file located in your project root., (*7)

$projectAuthors = Composed\project_config('authors');

assert($projectAuthors === [
    [
        'name' => 'Josh Di Fabio',
        'email' => 'joshdifabio@somewhere.com',
    ],
]);

Installation

Install Composed using composer., (*8)

composer require joshdifabio/composed

Credits

Credit goes to @igorw whose get-in library is partially copied into this library. Unfortunately, igorw/get-in requires PHP 5.4 while Composed aims for PHP 5.3 compatibility., (*9)

License

Composed is released under the MIT license., (*10)

The Versions

14/11 2016

dev-master

9999999-dev

Easily parse your project's Composer configuration, and those of its dependencies, at runtime.

  Sources   Download

MIT

The Requires

  • php >=7

 

by Josh Di Fabio

composer package dependency

17/07 2015

v1.0.0

1.0.0.0

Easily parse your project's Composer configuration, and those of its dependencies, at runtime.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Josh Di Fabio

composer package dependency