2017 © Pedro Peláez
 

library yaml-config-service-provider

A config ServiceProvider for Silex with support for yaml.

image

juuuuuu/yaml-config-service-provider

A config ServiceProvider for Silex with support for yaml.

  • Sunday, November 1, 2015
  • by juuuuuu
  • Repository
  • 1 Watchers
  • 1 Stars
  • 465 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

YamlConfigServiceProvider

Service provider for Silex v2.x using YAML configuration files., (*1)

Installation

To use it add following line to your composer.json:, (*2)

"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):, (*3)

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

Now you have access to all of your configuration variables through $app['parameters']., (*4)

Example

parameters.yml:, (*5)

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

index.php:, (*6)

    <?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'];

The Versions

01/11 2015

dev-master

9999999-dev

A config ServiceProvider for Silex with support for yaml.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Julien Manganne

silex yaml