glynnforrest / speedy-config
No-fuss configuration loader, processor and cache
v0.1.0
2017-04-03 16:02 UTC
Requires
- glynnforrest/crutches: ^0.3.2
Requires (Dev)
- phpunit/phpunit: ^5.7
- symfony/yaml: ^3.0
Suggests
- symfony/yaml: To use the yaml processor
This package is not auto-updated.
Last update: 2024-11-09 20:22:55 UTC
README
Load configuration from a variety of sources, process and validate it, then cache the result for speedy loading the next time.
Install
composer require glynnforrest/speedy-config
Usage
Create a config builder with the loaders and processors to use:
use SpeedyConfig\ConfigBuilder; use SpeedyConfig\Loader\YamlLoader; use SpeedyConfig\Loader\PhpLoader; use SpeedyConfig\Processor\ReferenceProcessor; $builder = new ConfigBuilder([new YamlLoader(), new PhpLoader()], new ReferenceProcessor());
Add resources to load:
$builder->addResource('config.php') ->addResource('config.yml');
Then get the resolved configuration.
$config = $builder->getConfig(); // instance of SpeedyConfig\Config