定制 brightnucleus/config-52 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

brightnucleus/config-52

Composer 安装命令:

composer require brightnucleus/config-52

包简介

Minimal, reusable Config component (without namespaces)

README 文档

README

Config component that does not use namespaces, to be used in PHP 5.2 projects.

Latest Stable Version Total Downloads Latest Unstable Version License

Table Of Contents

Introduction

Bright Nucleus Config 5.2 is a Config component similar to brightnucleus/config, but it does not use PHP namespaces, so that it can be used in projects that need to work on PHP 5.2.

As it uses Composer, it will need PHP 5.3.2+ to use during development. However, there's a PHP 5.2 autoloader file that is generated, so that you only need PHP 5.2+ at runtime.

This is a very reduced form of a Config component, though, and is meant to provide a very basic way for PHP 5.2 libraries to read existing config files. There's no default values, no validation, no fancy convenience functions.

Installation

To include the library in your project, you can use Composer:

composer require brightnucleus/config-52

Alternatively, you can copy the classes inside of your application and make sure that your application can find them.

Basic Usage

To use the component within your project, you should first load the 5.2 autoloader:

require dirname(__FILE__) . '/vendor/autoload_52.php';

Here's an example of how to use the class once it's been loaded:

<?php

use BrightNucleus_ConfigInterface as ConfigInterface;
use BrightNucleus_Config          as Config;

class WorldGreeter {

    /** @var  @var ConfigInterface */
    protected $config;

    public function __construct(ConfigInterface $config) {
        $this->config = $config;
    }

    public function greet() {
        $hello = $this->config->getKey('hello');
        $world = $this->config->getKey('world');
        echo "$hello $world";
    }
}

$config_file = dirname(__FILE__) . '/config/greetings.php';
$config      = new Config(include($config_file));

$worldGreeter = new WorldGreeter($config);
$worldGreeter->greet();

Contributing

All feedback / bug reports / pull requests are welcome.

License

This code is released under the MIT license. For the full copyright and license information, please view the LICENSE file distributed with this source code.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固