2017 © Pedro Peláez
 

library composer-extra

Get namespaced configuration from composer.json `extra`

image

schnittstabil/composer-extra

Get namespaced configuration from composer.json `extra`

  • Sunday, March 18, 2018
  • by schnittstabil
  • Repository
  • 1 Watchers
  • 2 Stars
  • 15,605 Installations
  • PHP
  • 10 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

ComposerExtra Build Status Coverage Status Scrutinizer Code Quality Code Climate

SensioLabsInsight, (*1)

Get namespaced configuration from composer.json extra., (*2)

Install

$ composer require schnittstabil/composer-extra

Typical Usage

End User

{
    "name": "end-user/project",
    "require": {
        "you/your-awesome-library": "*"
    },
    "extra": {
        "you/your-awesome-library": {
            "unicorns": 42
        }
    },
}

Your Library

require __DIR__.'/vendor/autoload.php';

# get end-user configuration
$config = new Schnittstabil\ComposerExtra\ComposerExtra('you/your-awesome-library');
$config->get('unicorns') //=> int(42)

API

namespace Schnittstabil\ComposerExtra;

/**
 * Get namespaced configuration from `composer.json`.
 */
class ComposerExtra
{
    /**
     * Create a new ComposerExtra.
     *
     * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValue`.
     *
     * @param string|int|mixed[] $namespace     a `Schnittstabil\Get\getValue` path
     * @param mixed              $defaultConfig default configuration
     * @param string             $presetsPath   presets path (w/o namespace)
     *
     * @throws \KHerGe\File\Exception\ResourceException
     * @throws \Seld\JsonLint\ParsingException
     */
    public function __construct($namespace = array(), $defaultConfig = null, $presetsPath = null);

    /**
     * Get configuration value.
     *
     * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValue`.
     *
     * @param string|int|mixed[] $path    a `Schnittstabil\Get\getValue` path
     * @param mixed              $default default value if $path is not valid
     *
     * @return mixed the value determined by `$path` or otherwise `$default`
     */
    public function get($path = array(), $default = null);

    /**
     * Get configuration value.
     *
     * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValueOrFail`.
     *
     * @param string|int|mixed[] $path    a `Schnittstabil\Get\getValueOrFail` path
     * @param mixed              $message exception message
     *
     * @throws \OutOfBoundsException if `$path` is not valid
     *
     * @return mixed the value determined by `$path`
     */
    public function getOrFail($path = array(), $message = null);
}

License

MIT © Michael Mayer, (*3)

The Versions

18/03 2018

dev-master

9999999-dev

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

18/03 2018

2.1.0

2.1.0.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

13/02 2017

2.0.0

2.0.0.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

30/10 2016

1.0.1

1.0.1.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

04/04 2016

0.3.0

0.3.0.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

03/04 2016

0.2.0

0.2.0.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json

03/04 2016

0.1.0

0.1.0.0

Get namespaced configuration from composer.json `extra`

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration composer extra composer.json