slabphp/configuration-manager 问题修复 & 功能扩展

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

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

slabphp/configuration-manager

Composer 安装命令:

composer require slabphp/configuration-manager

包简介

SlabPHP Configuration Manager

README 文档

README

SlabPHP Configuration Manager Library. This is an extracted version of the configuration utility from the Slab framework. It is designed to work with "PHP Configuration files".

Installation

Include this project with composer:

composer require slabphp/configuration-manager

Usage

Create and configure the manager.

$manager = new \Slab\Configuration\Manager($configuration);
$manager
    ->setFileDirectories(['/some/directory', '/some/other/directory'])
    ->loadConfiguration();

This will instantiate a configuration manager that will look for "php configuration" files in the following directories:

  • /some/directory/default.php
  • /some/directory/override.php
  • /some/other/directory/default.php
  • /some/other/directory/override.php

The values in each will override the previously read files. You can use the secondary files to use stages based on an environment variable or server name.

Assuming this is the contents of the "php configuration" file at /some/directory/default.php:

<?php
   
$config['someValue'] = true;
$config['something'] = [
    'something' => 'something else',
    'subValue' => [
        'thing' => 'fromage'
    ]
];

You would have available to you the following values in your calling code:

echo $manager->someValue; //outputs true (or 1, whatever php)
echo $manager->something->something; //outputs 'something else'
echo $manager->something->subValue->thing; //outputs 'fromage'

Library Caveats

You can feel free to use this, submit bugs, contact us, or submit change requests. The SlabPHP framework is largely in maintenance mode at the moment and is in the process of being released open source under the Apache 2.0 license. We're well aware that better alternatives exist in this day and age, please see the SlabPHP main documentation for more details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2018-03-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固