2017 © Pedro Peláez
 

library scabbia2-config

Scabbia2 Config Component

image

scabbiafw/scabbia2-config

Scabbia2 Config Component

  • Tuesday, September 22, 2015
  • by eserozvataf
  • Repository
  • 1 Watchers
  • 1 Stars
  • 70 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Scabbia2 Config Component

This component is a configuration compiler which supports binding multiple configuration files., (*1)

Build Status Scrutinizer Code Quality Total Downloads Latest Stable Version Latest Unstable Version Documentation Status, (*2)

Usage

Merging multiple configurations

use Scabbia\Config\ConfigCollection;

$confs = new ConfigCollection();

// add a yaml-parsed configuration
$yaml = new \Scabbia\Yaml\Parser();
$confs->add($yaml->parse(file_get_contents('common.yml')));

// ...and/or add a json file
$confs->add(json_decode(file_get_contents('production.json')));

// ...and/or add a configuration value manually
$confs->add([
    'env' => 'development'
]);

// output the result
$config = $confs->save();
print_r($config);

Overriding an existing configuration item

use Scabbia\Config\ConfigCollection;

$confs = new ConfigCollection();

$confs->add([
    'env' => 'production'
]);

// in second config you can override a value with 'important' flag
$confs->add([
    'env|important' => 'development'
]);

// output the result
$config = $confs->save();
echo $config['env'];

Constructing a list in separate configurations

use Scabbia\Config\ConfigCollection;

$confs = new ConfigCollection();

$confs->add([
    'items|list' => [
        'first',
        'second'
    ]
]);

// in second config you can override a value with 'important' flag
$confs->add([
    'items|list' => [
        'third'
    ]
]);

// output the result
$config = $confs->save();
print_r($config['items']);

Flatten configuration value keys

use Scabbia\Config\ConfigCollection;

$confs = new ConfigCollection();

$confs->add([
    'database|flat' => [
        'mongo' => [
            'username' => 'scabbia2',
            'password' => 'testing'
        ]
    ]
]);

// output the result
$config = $confs->save();
echo $config['database/mongo/username'];
echo $config['database/mongo/password'];

Contributing

It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome. All contributions should be filed on the eserozvataf/scabbia2-config repository., (*3)

  • To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
  • To report a bug: If something does not work, please report it using GitHub issues.
  • To support: Donate

The Versions

22/09 2015

dev-master

9999999-dev http://www.scabbiafw.com/

Scabbia2 Config Component

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

config scabbia larukedi scabbia2 scabbiafw

16/09 2015

v0.1.1

0.1.1.0 http://www.scabbiafw.com/

Scabbia2 Config Component

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

config scabbia larukedi scabbia2 scabbiafw