phpactor/config-loader
最新稳定版本:0.1.2
Composer 安装命令:
composer require phpactor/config-loader
包简介
Library to load (user) configuration
README 文档
README
Library to load an application configuration file
Usage
$loader = new ConfigLoader( new Deserializers([ 'json' => new JsonDeserializer(), ]), new PathCandidates([ new XdgPathCandidate('myapp', 'config.json', 'json'), new AbsolutePathCandidate(getcwd() . '/' . 'myapp.json', 'json'), ]) ); $config = $loader->load();
The above will:
- Load existing config from XDG config directory for
myapp(e.g.$HOME/.config/myapp/config.json). - Merge existing config from the current working directory if it exists.
Deserializers
- JsonDeserializer: Deserializes using
json_decode. Very fast. - YamlDeserializer: Deserializes using the Symfony YAML parser requires
symfony/yaml
Path Candidates
- XdgPathCandidate: Represents candidate config file in the XDG config path for an application.
- AbsolutePathCandidate: Represents an arbitrary config file at an absolute path.
Contributing
This package is open source and welcomes contributions! Feel free to open a pull request on this repository.
Support
- Create an issue on the main Phpactor repository.
- Join the
#phpactorchannel on the Slack Symfony Devs channel.
统计信息
- 总下载量: 40.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-01