bshirey/hierarchical-config
最新稳定版本:v1.1.3
Composer 安装命令:
composer require bshirey/hierarchical-config
包简介
Provides inheritance and hierarchical configuration tools.
README 文档
README
======================
Documentation on its way. This is a tool to assist in creating hierarchical configurations, where layers of configuration data are merged, with higher layers overwriting lower layers.
How To Use
============
First, you must add this library to your project. If you are using composer, try this: > composer require bshirey/hierarchical-config:1.*
This library does not do much on its own, but requires some setup in your project. At a minimum, you must implement your own ConfigBuilder with a custom implementation of the build() function. The ConfigBuilder is responsible to instantiating ConfigInterface objects. The ConfigBuilder is responsible for stacking ConfigInterface objects hierarchically.
For example:
public class MyApplicationConfigBuilder implements ConfigBuilder
{
public function build($options = array())
{
$config = new GenericConfig($options);
$config
->push(new FileConfig($options))
->push(new GlobalsConfig($options))
->push(new EnvConfig($options));
return $config;
}
...
Then your application needs to setup the ConfigFactory singleton, similar to the following:
ConfigFactory::getInstance() ->setOptions($options) ->setBuilder(new MyApplicationConfigBuilder());
Finally, you must make your configurable classes / objects use the HierarchicalConfig\Configurable trait:
use HierarchicalConfig\Configurable; public class MyApplicationClass { use Configurable; ...
How To Run The Tests
======================
This glosses over the details a bit. Needless to say you need to have composer installed as well as phpunit and any dependencies.
- Run composer install if you haven't already. This installs project dependencies.
- Run phpunit.
- Let the tests run.
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2015-06-20