ronanchilvers/silex-yaml-config-provider

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Simple YAML config provider for Silex 1.3+

0.1 2016-01-12 22:20 UTC

This package is auto-updated.

Last update: 2021-06-08 07:34:43 UTC


README

SensioLabsInsight

A very simple YAML config provider for Silex 1.3+ allowing you to read your configuration in from YAML files.

Installation

The easiest mechanism is via composer. Add the provider to your composer.json:

{
    "require": {
        "ronanchilvers/silex-yaml-config-provider": "dev-master"
    }
}

Usage

To register the service provider you can do something like this:

$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.

$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.

  • config - The parsed configuration data as an array