承接 anax/configure 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

anax/configure

Composer 安装命令:

composer require anax/configure

包简介

Anax Configure module, for reading config files.

README 文档

README

Latest Stable Version Join the chat at https://gitter.im/canax/configure

Build Status CircleCI

Build Status Scrutinizer Code Quality Code Coverage

PHPStan Maintainability Codacy Badge

Read configuration files for Anax and Anax modules.

The configuration files for a module can be stored in one of several base directories. The Configuration class scans all valid base directories and stops at the first one containing configuration items.

The configuration items can be stored in a file, and/or in a directory containing several files. All files are loaded and combined into one array containing each bits and piece of the module configuration.

Install

$ composer require anax/configure

Related classes

These are the classes included in this module, and their primary purpose.

Class Purpose
Configuration Read configuration files and store in array.

Use as DI service

You can create the Configuration object as a $di service. That is how Anax does it.

Sample usage

Create a object that can read configuration files.

First create the object and point it to a set of directories.

$config = new \Anax\Configure\Configuration();
$dirs = ["path1", "path2"];
$config->setBaseDirectories($dirs);

Now use the objekt to find and load configuration files for an item, in the example we are using the module "router" as an example.

$config = $di->get("configuration")->load("route")

The $config will now contain the configuration items found from the file, or files. You could now provide the array to the module or object that should use it.

A configuration file

A configuration file for a module "route" is any, or a combination of the following.

File/path What
route.php A file.
route/*.php Several files.

The files should return a value, which will be its contribution to the configuration.

The configuration array

The resulting configuration array looks like this, still using "route" as example for the module name.

$config = [
    "file" => filename for route.php,
    "config" => result returned from route.php,
    "items" => [
        [
            "file" => filename for route/file1.php,
            "config" => result returned from route/file1.php,
        ],
        [
            "file" => filename for route/file2.php,
            "config" => result returned from route/file2.php,
        ],
    ].
];

Tha "route" module can then decide on how to use the actual configuration details.

Dependency

There are no dependencies.

License

This software carries a MIT license. See LICENSE.txt for details.

 .  
..:  Copyright (c) 2013 - 2018 Mikael Roos, mos@dbwebb.se

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固