robotdance/php-app-config
Composer 安装命令:
composer require robotdance/php-app-config
包简介
A PHP helper component to store package/application settings
README 文档
README
PHP-app-config is a component to store application/package settings, also capable of storing it per environment if necessary.
Setup
PHP-app-config uses Composer as dependency management tool. Create or ppdate your composer.json file and run:
$ composer install or $ composer update
Use
Create a folder called config/ at your app/package, and put your YAML config.yml file there.
(an example of valid YAML file can found in the source). Then call Config::get, in one of the ways below.
YAML Config file structure
Your YAML config.yml file may look like this:
some_setting: development: some setting development test: some setting test production: some setting production another_setting: another setting without environment
This way you can store settings depending on environment or not. Your choice. In order to have environment specific settings, you must set an environment variable called "ENVIRONMENT", with a value that can be found at your config file.
Example
The example below will try to find the key variable_name.[environment] at /config/config.yml:
use robotdance\Config; ... $value = Config::get('variable_name');
Running tests
$ ./bin/phpunit
Contribute
Fork, write tests, code, submit pull request. Coverage must remains at 100%.
统计信息
- 总下载量: 333
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-10