垃圾箱/yaml-配置服务提供程序

Silex 的 YAML 配置服务提供程序

0.2.0 2020-06-18 15:02 UTC

This package is auto-updated.

Last update: 2024-09-19 00:01:50 UTC


README

Silex 的 YAML 配置服务提供程序

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality License

要求

silex 2.x

安装

安装 YamlConfigurationServiceProvider 的最佳方法是使用 Composer

php composer.phar require junker/yaml-configuration-service-provider

支持

  • 递归配置导入(配置组织
  • 配置缓存(性能提升)

示例

use Junker\Silex\Provider\YamlConfigurationServiceProvider;

$app->register(new YamlConfigurationServiceProvider('config.yml'));

# or

$app->register(new YamlConfigurationServiceProvider('config.yml', ['cache_dir' => '/tmp/config_cache']));

$db_host = $app['config']['db']['host'];

配置示例

imports:
     - { resource: 'site/config.yml' }
     - { resource: 'security.yml' }

db:
    host: localhost
    login: root
    pass: 123123
    database: site12

facebook:
    scope: 'public_profile,email,user_birthday,user_location,user_photos'
    secret_key: FDSLKFDNSLsdre23lkndas