2017 © Pedro Peláez
 

library simpleconfig

A basic configuration container class

image

nick-jones/simpleconfig

A basic configuration container class

  • Thursday, February 6, 2014
  • by nick-jones
  • Repository
  • 1 Watchers
  • 0 Stars
  • 118 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SimpleConfig

SimpleConfig is a basic configuration container, for PHP., (*1)

Installation

To pull down dependencies and check version compatibility you will need to run composer in the project root., (*2)

Usage

Values and factories can be provided in the constructor:, (*3)

$container = new \SimpleConfig\Container(
    [
        'field1' => 'value',
        // etc
    ],
    [
        'field2' => function() {
            return new Foo();
        }
    ]
);

Alternatively, offsetSet and factory can be used to add values and factories respectively., (*4)

The Container class implements ArrayAccess, so values can simply be accessed using array syntax, e.g., (*5)

echo $container['field1']; // prints "value"

Factories are invoked once on field fetch, with the resulting value being cached for future use. Factories can retrieve other values from the container by simply utilising $this, e.g., (*6)

$container->factory('foo', function() {
    $class = $this['foo.class'];
    return new $class();
});

The Versions

06/02 2014

dev-master

9999999-dev

A basic configuration container class

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Nicholas Jones

container configuration config

06/02 2014

v0.1

0.1.0.0

A basic configuration container class

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Nicholas Jones

container configuration config