webiny/config 问题修复 & 功能扩展

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

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

webiny/config

最新稳定版本:v1.6.1

Composer 安装命令:

composer require webiny/config

包简介

Webiny Config Component

README 文档

README

Config component creates ConfigObject instances from config files. Currently supported formats: INI, JSON, PHP, YAML and custom drivers.

Install the component

The best way to install the component is using Composer.

composer require webiny/config

For additional versions of the package, visit the Packagist page.

Usage

To use Config component you will need a config file.

Example INI:

[properties]
a = "value"
b.name = "name"
b.value = "value"

Here is an example of creating a ConfigObject:

    $config = \Webiny\Components\Config\Config::getInstance()->ini('path/to/file.ini');

This will result in $config object containing the following properties:

    $config->properties->a = 'value';
    $config->properties->b->name = 'name';
    $config->properties->b->value = 'value';

If you don't want to use INI sections, or set custom nest delimiter, specify the following arguments:

    $config = \Webiny\Components\Config\Config::getInstance()->ini('path/to/file.ini', false, '_');

You can get your config as string in any format using the following methods:

    $string = $config->getAsJson();
    $string = $config->getAsPhp();
    $string = $config->getAsIni($useSections = true, $nestDelimiter = '.');
    $string = $config->getAsYaml($indent = 4);

And you can also use custom driver

    $driverInstance = new MyCustomDriver();
    $string = $config->getAs($driverInstance);

You can also merge one config with another ConfigObject or array:

$config->mergeWith($config2);

Resources

To run unit tests, you need to use the following command:

$ cd path/to/Webiny/Component/Config/
$ composer.phar install
$ phpunit

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 8
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固