phpactor/config-loader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phpactor/config-loader

最新稳定版本:0.1.2

Composer 安装命令:

composer require phpactor/config-loader

包简介

Library to load (user) configuration

README 文档

README

CI

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 #phpactor channel on the Slack Symfony Devs channel.

统计信息

  • 总下载量: 40.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-01