Download the PHP package anax/configure without Composer
On this page you can find all versions of the php package anax/configure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anax/configure
More information about anax/configure
Files in anax/configure
Package configure
Short Description Anax Configure module, for reading config files.
License MIT
Homepage https://dbwebb.se/anax
Informations about the package configure
Anax Configure
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
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.
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.
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.
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.