2017 © Pedro PelĂĄez
 

library config-service-provider

Load yaml, php, directory config to into your container

image

sergiors/config-service-provider

Load yaml, php, directory config to into your container

  • Wednesday, November 30, 2016
  • by sergiors
  • Repository
  • 2 Watchers
  • 1 Stars
  • 326 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 0 Forks
  • 1 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Config Service Provider

Install

composer require sergiors/config-service-provider

How to use

Let's imagine you want to load the following yaml file:, (*1)

imports:
    - { resource: config.yml }

twig.options:
    debug: false

db.options:
    driver: ~
    host: ~
    user: ~
    password: ~
    dbname: ~

routing.options:
    paths: %root_dir%/app/routing.yml

In your php file, (*2)

use Sergiors\Silex\Provider\ConfigServiceProvider;

$app->register(new ConfigServiceProvider(), [
    'config.filenames' => '%root_dir%/config/config_%env%.yml',
    'config.replacements' => [
        'root_dir' => dirname(__DIR__)
    ]
]);

$app['config.initializer']();

Now you can access $app['twig.options']['debug'] and others, (*3)

License

MIT, (*4)

The Versions

01/06 2016