YamlConfigServiceProvider
, (*1)
A very simple YAML config provider for Silex 1.3+ allowing you to read your configuration in from YAML files., (*2)
Installation
The easiest mechanism is via composer. Add the provider to your composer.json:, (*3)
{
"require": {
"ronanchilvers/silex-yaml-config-provider": "dev-master"
}
}
Usage
To register the service provider you can do something like this:, (*4)
$app->register(new \Ronanchilvers\Silex\Provider\YamlConfigServiceProvider(
'/path/to/my/yaml/config.yml'
));
You can add the provider multiple times if you want to parse multiple files and the configuration will be merged together., (*5)
$app->register(new \Ronanchilvers\Silex\Provider\YamlConfigServiceProvider(
'/path/to/my/yaml/config.base.yml'
));
$app->register(new \Ronanchilvers\Silex\Provider\YamlConfigServiceProvider(
'/path/to/my/yaml/config.production.yml'
));
Services Exposed
The YamlConfigServiceProvider exposes the following services., (*6)
-
config
- The parsed configuration data as an array