Skip to content
Fastest PHP config ever
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Sphido / Config

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Sphido config loading configurations as pure PHP arrays/objects it's doing only array_replace_recursive!

  • 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

	include __DIR__ . '/config.base.php',
	include __DIR__ . '/config.stable.php'

Your config.base.php need return some array values e.g.:

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:

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

It's pure PHP you can store whatever you need:

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

Reinit config values

Sometimes you can need change whole config content in runtime

/app/config(); // you can init empty config
/app/config(['oldConfigValues' => 'This is old content']);
/app/config(['reinitValues' => 'Reinit again...']);
You can’t perform that action at this time.