承接 xervice/config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

xervice/config

最新稳定版本:3.1.0

Composer 安装命令:

composer require xervice/config

包简介

Config environment to xervice components

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status

Config loader for Xervice services.

Installation

composer require xervice/config

Configuration

  1. Add a config directory to your root path
  2. In there you have different config files parsed in this order:
    • config_default.php
    • config_<APPLICATION_ENV>.php
    • config_<APPLICATION_ENV>_<APPLICATION_SCOPE>.php
    • config_local.php
    • (additional config files defined in previous config file)

APPLICATION_ENV is a environment variable. The default value is "production". APPLICATION_SCOPE is a environment variable. The default value is "main".

To add additional config files you can add them to your config_default:

$config[\Xervice\Config\XerviceConfig::ADDITIONAL_CONFIG_FILES] = [
    __DIR__ . '/addition_config.php'
];

If you want to change the config-directory, you can set the environment variable CONFIG_PATH. If no CONFIG_PATH is defined, it will look under the environment variable <APPLICATION_PATH>/config. If no APPLICATION_PATH is defined, it will look in the current workdir.

Usage

$configProvider = new XerviceConfig(new XerviceConfigFactory());
$config = $configProvider->getConfig();

$value = $config->get('CONFIG_KEY');

$valueWithDefault = $config->get('CONFIG_KEY', 'defaultvalue');


// Or with the static method way
$configProvider = XerviceConfig::getInstance();
$config = $configProvider->getConfig();

...

// Or direct static access
XerviceConfig::set('key', 'value');
XerviceConfig::get('key'); // value

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-17