2017 © Pedro Peláez
 

library configure

Anax Configure module for reading config files.

image

anax/configure

Anax Configure module for reading config files.

  • Friday, March 16, 2018
  • by mikael_roos
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3,960 Installations
  • PHP
  • 27 Dependents
  • 2 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 10 % Grown

The README.md

Anax Configure

Latest Stable Version Join the chat at https://gitter.im/canax/configure, (*1)

Build Status CircleCI, (*2)

Build Status Scrutinizer Code Quality Code Coverage, (*3)

PHPStan Maintainability Codacy Badge, (*4)

Read configuration files for Anax and Anax modules., (*5)

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., (*6)

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., (*7)

Install

$ composer require anax/configure

These are the classes included in this module, and their primary purpose., (*8)

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., (*9)

Sample usage

Create a object that can read configuration files., (*10)

First create the object and point it to a set of directories., (*11)

$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., (*12)

$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., (*13)

A configuration file

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

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., (*15)

The configuration array

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

$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., (*17)

Dependency

There are no dependencies., (*18)

License

This software carries a MIT license. See LICENSE.txt for details., (*19)

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

The Versions

16/03 2018

dev-master

9999999-dev https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

16/03 2018

v1.0.5

1.0.5.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

26/09 2017

v1.0.4

1.0.4.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

26/09 2017

v1.0.3

1.0.3.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

17/08 2017

v1.0.2

1.0.2.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

10/08 2017

v1.0.1

1.0.1.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education

04/05 2017

v1.0.0

1.0.0.0 https://dbwebb.se/anax

Anax Configure module for reading config files.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

micro framework boilerplate mvc education