dev-master
9999999-devConfiguration reader with league/container service provider
MIT
The Requires
- php ^7.0
- league/container ^2.0
by Samuel Carlier
Configuration reader with league/container service provider
Configuration reader with league/container service provider, (*1)
pecl install yml
composer require slashlead/configuration
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)
the parsed config array will be provided in the container with alias "configStore", (*5)
<?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'));
Configuration reader with league/container service provider
MIT