kohkimakimoto/application-config-service-provider

This is a Silex ServiceProvider to use yaml configuration files.

dev-master 2013-07-01 00:23 UTC

README

Build Status

This is a Silex ServiceProvider to use yaml configuration files.

Synopsis

# config.yml
param: AAA
param2: BBB
param3:
    param3-1: aaa
    param3-2: aaa
// something.php
use Silex\Application;
use Kohkimakimoto\Silex\Provider\ApplicationConfigServiceProvider;

$app = new Application();
$app->register(new ApplicationConfigServiceProvider(), array(
      'config.path' => __DIR__.'config.yml'
));

$app['config']->get('param');    # AAA
$app['config']->get('param4');   # null
$app['config']->get('param4', "default");   # default

$app['config']->get('param3');   # array('param3-1' => 'aaa', 'param3-2' => 'aaa')

$app['config']->get('param3/param3-1', null, '/');   # aaa