blast / config
Framework agnostic configuration package
1.0.2
2016-01-10 10:06 UTC
Requires
- php: >=5.5.0
- blast/facades: dev-master
- league/container: ~2.0
- puli/repository: ^1.0
- symfony/filesystem: ~2.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2024-11-05 04:18:25 UTC
README
Framework agnostic configuration package supporting php and json. More file types under development.
Install
Via Composer
$ composer require blast/config
Usage
Only a few lines of code:
<?php
$factory = new Factory();
// define your base location for all configurations
$locator = $factory->create(__DIR__ . '/res');
// receive config from json as array
$config = $factory->load('/config/config.json', $locator);
// receive config as array
$config = $factory->load('/config/config.php', $locator);
Dependency injection
Configure ServiceProvider and Facade.
<?php
$container = new Container();
$container->addServiceProvider(new ConfigServiceProvider());
FacadeFactory::setContainer($container);
Load your configuration.
<?php
// define your base location for all configurations
Config::create(__DIR__ . '/res');
// receive config from json as array
$config = Config::load('/config/config.json', $locator);
Further development
Please visit our milestones
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email :author_email instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.