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

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

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

wwtg99/config

Composer 安装命令:

composer require wwtg99/config

包简介

README 文档

README

Installation

Install from composer

composer require "wwtg99/config"

Or in composer.json require

"wwtg99/config": "*"

Usage

$conf = new ConfigPool();  // or new ConfigPool('path/to/cache_file') to enable cache
// Define config resource
// File config source should specify conf directories and conf files. Config will be merged by array_merge().
$source = new FileSource(['default__conf', 'user_conf'], ['conf1.json', 'conf2.php']);
// Define file loader to handle conf files. Supported loaders: JsonLoader, PHPLoader, YamlLoader.
$source->addLoader(new JsonLoader())->addLoader(new PHPLoader());
// Redis source should defined the key (default config) and redis parameters.
// If use redis, should disable cache to get better performance and enable to deploy central configuration.
// $source = new RedisSource();
// Set source for config, one source or an array of sources
$conf->addSource($source);
// Load config
$conf->load();
// Get config, support dot(.) to search in array, ex: a.b.c search for a['b']['c']
$val = $conf->get('name', 'default_val');
// Use .(dot) to search array
$val = $conf->get('arr.val');
// Set config
$conf->set('name', 'val');
// Get changed config by export()
$config = $conf->export();
// Save changed config to cache if use cache file
$conf->saveCache();

If use cache file and cache file exists, config will always loaded from cache regardless of origin conf files.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固