2017 © Pedro Peláez
 

library config

Fastest config ever

image

sphido/config

Fastest config ever

  • Saturday, June 4, 2016
  • by OzzyCzech
  • Repository
  • 2 Watchers
  • 6 Stars
  • 2,733 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

Sphido / Config

Sphido config loading configurations as pure PHP arrays/objects it's doing only array_replace_recursive!, (*1)

  • no obscure config file parsers
  • no extra config file formats
  • no unnecessary code
  • no power loss

Setup values

It's simple, just call config() in your index.php to setup values, (*2)

/app/config(
    [],
    include __DIR__ . '/config.base.php',
    include __DIR__ . '/config.stable.php'
);

Your config.base.php need return some array values e.g.:, (*3)

return [
    'example' => 'value',
    'invokeme' => function() {}
    'constant' => PHP_VERSION,
    'execute' => $a + $b
    'object' => (object)['a' => 'b', 'c' => 'd']
    'array' => ['a' => 'b', 'c' => 'd']
];

Read and Write

Then simply read and write any values:, (*4)

/app/config()->example = 'save'
echo /app/config()->example; // will print save

It's pure PHP you can store whatever you need:, (*5)

/app/config()->invokeme = function() { return 'something'};
call_user_func(config()->invokeme);

Reinit config values

Sometimes you can need change whole config content in runtime, (*6)

/app/config(); // you can init empty config
/app/config(['oldConfigValues' => 'This is old content']);
/app/config(['reinitValues' => 'Reinit again...']);
/app/config()->reinitValues;

The Versions

04/06 2016

dev-master

9999999-dev http://www.sphido.org

Fastest config ever

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

The Development Requires

config

04/06 2016

v2.0.0

2.0.0.0 http://www.sphido.org

Fastest config ever

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.6.0

 

The Development Requires

config

14/07 2015

1.0.1

1.0.1.0 http://www.sphido.org

Fastest config ever

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.6

 

The Development Requires

config

19/01 2015

v1.0.0

1.0.0.0 http://www.sphido.org

Fastest config ever

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.6

 

The Development Requires

config