定制 juuuuuu/yaml-config-service-provider 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

juuuuuu/yaml-config-service-provider

Composer 安装命令:

composer require juuuuuu/yaml-config-service-provider

包简介

A config ServiceProvider for Silex with support for yaml.

关键字:

README 文档

README

Service provider for Silex v2.x using YAML configuration files.

Installation

To use it add following line to your composer.json:

"require": {
    ...
    "juuuuuu/yaml-config-service-provider": "1.0.x-dev"
    ...
}

Usage

Include following line of code somewhere in your initial Silex file (index.php or whatever):

    $app->register(new Juuuuuu\Silex\YamlConfigServiceProvider(__DIR__.'/../app/config/parameters.yml'));

Now you have access to all of your configuration variables through $app['parameters'].

Example

parameters.yml:

parameters:
    webservice:
        url: http://host.com
        username: user
        password: pass

index.php:

    <?php
        require_once __DIR__.'/../vendor/autoload.php';

        $app = new Silex\Application();

        // Considering the parameters.yml files is in app/config directory
        $app->register(new Juuuuuu\Silex\YamlConfigServiceProvider(__DIR__.'/../app/config/parameters.yml'));

        $wsUrl = $app['parameters']['webservice']['url'];

统计信息

  • 总下载量: 500
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-01