2017 © Pedro Peláez
 

library configuration

Configuration reader with league/container service provider

image

slashlead/configuration

Configuration reader with league/container service provider

  • Thursday, December 1, 2016
  • by NoboSam
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Configuration reader with league/container service provider, (*1)

Installation

yml extension

pecl install yml

composer

composer require slashlead/configuration

Configuration files

The path where configuration is stored and the environment name must be exposed in the $_SERVER., (*2)

the key names are: - application_mode, the name of the yml file that is loaded - config_dir, the dir where configuration files are stored, (*3)

Configuration files need to be stored in yml format, (*4)

How to use

Provided service

the parsed config array will be provided in the container with alias "configStore", (*5)

Example code

<?php
/*
 For demo use we set $_SERVER parameters in this script
 with this example code the following config will be loaded
 /var/www/html/config/development.yml
 */

$_SERVER['application_mode'] = 'development';
$_SERVER['config_dir']       = '/var/www/html/config';

$container = new \League\Container\Container();
$container->addServiceProvider(new Slashlead\Component\Configuration\ServiceProvider);

print_r($container->get('configStore'));

The Versions

01/12 2016

dev-master

9999999-dev

Configuration reader with league/container service provider

  Sources   Download

MIT

The Requires

 

by Samuel Carlier