Skip to content

A Config Implementaion of our config PSR recommendation, inspired by mrjgreen/config

License

Notifications You must be signed in to change notification settings

ecfectus/config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Config

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',
);
*/

About

A Config Implementaion of our config PSR recommendation, inspired by mrjgreen/config

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages