conformity/config

A Config Implementation of our config PSR recommendation

dev-master 2016-04-08 13:06 UTC

This package is not auto-updated.

Last update: 2024-10-26 19:10:42 UTC


README

A Config Implementation inspired by mrjgreen/config

References:

https://github.com/mrjgreen/config

https://github.com/ecfectus/config-recommendation

Example file structure:

config
|
|____ production
|        |
|        |_______ server1
|        |       |___ redis.php
|        |       |___ database.php
|        |
|        |_______ server2
|        |       |___ database.php
|        |
|        |_______ database.php
|
|____ app.php
|____ database.php
|____ redis.php

Example usage

$environment = '';

$config = new Ecfectus\Config\Repository(new Ecfectus\Config\FileLoader(__DIR__ . '/config'), $environment);

var_dump($config['database']);
/*
array(
   'config_value' => 'foo',
   'config_value2' => 'bar'
);
*/

//________________________________________________________________________

$environment = 'production.server1';

$config = new Ecfectus\Config\Repository(new Ecfectus\Config\FileLoader(__DIR__ . '/config'), $environment);

var_dump($config['database']);
/*
array(
   'config_value' => 'baz',
   'config_value2' => 'bar',
   'new_config_only_for_server1' => 'boo',
);
*/