koikimakimoto/application-config-service-provider

这是一个用于使用yaml配置文件的Silex ServiceProvider。

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

This package is auto-updated.

Last update: 2024-09-06 23:46:38 UTC


README

Build Status

这是一个Silex ServiceProvider,用于使用yaml配置文件。

概要

# 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