watoki / cfg
Configuration loader
Installs: 461
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/watoki/cfg
Requires
- php: >=5.3.8
- watoki/factory: *
Requires (Dev)
- watoki/scrut: *
This package is not auto-updated.
Last update: 2025-10-11 19:38:47 UTC
README
cfg is a simple configuration loader.
Usage
Given you have a configuration class name\space\MyAppConfiguration then you can overwrite it with a
deployment-specific configuration name\space\MyConfiguration in a file some/folder/MyConfiguration.php and load it with
$loader = new Loader(new Factory());
$config = $loader->loadConfiguration('name\space\MyAppConfiguration', 'some/folder/MyConfiguration.php');
This will result in MyConfiguration being set as singleton for MyAppConfiguration, so whenever the latter one is
injected through the Factory, the former is used instead.
Note that MyConfiguration needs to be in the same namespace as MyAppConfiguration and the name of the containing file matches
the class name.
Installation
To use cfg in your own project with Composer, add the following lines to your composer.json.
"require" : {
"watoki/cfg" : "*"
}