flaviovs/uconfig 问题修复 & 功能扩展

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

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

flaviovs/uconfig

Composer 安装命令:

composer require flaviovs/uconfig

包简介

A micro, no frills, configuration interface for PHP

README 文档

README

Usage:

$handler = new \UConfig\INIFileHandler('/path/to/config.ini');
$defaults = [
    'section' => [
        'bar' => 1,
        'zoo' => 2,
    ],
];
$config = new \UConfig\Config($defaults);
$config->addHandler(new \UConfig\INIFileHandler('/path/to/config.ini'));

$bar = $config->get('section', 'bar');
// $bar = 1

try {
    $config->get('nonexistent', 'bar');
} catch ( \UConfig\SectionNotFoundException $ex ) {
    die("Section not found: " . $ex->getMessage());
} catch ( \UConfig\OptionNotFoundException $ex ) {
    die("Option not found: " . $ex->getMessage());
}

Handlers

Configuration is handled by configuration handlers. To implement a new handler, add a class that implements the UConfig\Handler interface, with a method called load() that returns a configuration array, which must be structured as follows:

 $config = [
     'section' => [
         'key1' => value,
         'key2' => value,
         //(...)
     ],
     'anothersection' => [
         'key1' => value,
         'key2' => value,
         //(...)
    ]
]

A UConfig\Config object may have many handlers attached to it. Use the addHandler() method to add handlers. Configuration is loaded in sequence, with later handler overriding previous ones.

Currently, only the UConfig\INIFileHandler is provided. Other handlers may be added in the future.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固