Skip to content
This repository was archived by the owner on Jun 3, 2026. It is now read-only.

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YamlConfigServiceProvider

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

About

Simple Yaml config file service provider for Silex 2.x

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages