PHPackages                             anax/configure - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. anax/configure

ActiveLibrary[Framework](/categories/framework)

anax/configure
==============

Anax Configure module, for reading config files.

v2.0.1(5y ago)020.2k↓100%1MITPHPPHP ^7.2CI failing

Since May 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/canax/configure)[ Packagist](https://packagist.org/packages/anax/configure)[ Docs](https://dbwebb.se/anax)[ RSS](/packages/anax-configure/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (17)Used By (0)

Anax Configure
==============

[](#anax-configure)

[![Latest Stable Version](https://camo.githubusercontent.com/53479f29ff4ea1211d3221e641e9affe7ec9ffcb10fecaf68c50d30f306b11d7/68747470733a2f2f706f7365722e707567782e6f72672f616e61782f636f6e6669677572652f762f737461626c65)](https://packagist.org/packages/anax/configure)[![Join the chat at https://gitter.im/canax/configure](https://camo.githubusercontent.com/76494817981aad6685973df0bfc7d192dc7d0d1e82d09f163e08b436f059e46c/68747470733a2f2f6261646765732e6769747465722e696d2f63616e61782f636f6e6669677572652e737667)](https://gitter.im/canax/configure?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/9320db2ccaf870019db12448b6b072dc6cfa23b2d2758a5bc0bcd90c645e9745/68747470733a2f2f7472617669732d63692e6f72672f63616e61782f636f6e6669677572652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/canax/configure)[![CircleCI](https://camo.githubusercontent.com/6297342e80223507b806e31c0300c81271b2541f79733e12dbe28cd1ec24fc5c/68747470733a2f2f636972636c6563692e636f6d2f67682f63616e61782f636f6e6669677572652e7376673f7374796c653d737667)](https://circleci.com/gh/canax/configure)

[![Build Status](https://camo.githubusercontent.com/73841f514ad5a8a2da9f2d67243bf00d18022301f6b14b0c862f9ea3b7bcd4ec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6e6669677572652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/configure/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/823cf68577254f37a43a3e6f347f8f7249082507e1192d61ec48dfe2c61c3226/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6e6669677572652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/configure/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/2be0776b117545eabfde0cd0bc22b83ba8d19e89fef16f67fab223933a80f760/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63616e61782f636f6e6669677572652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/canax/configure/?branch=master)

[![PHPStan](https://camo.githubusercontent.com/3893febf97b8b04381c64adb0740bef5d8f6d65977cea4295d51758607924120/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230302d627269676874677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/3893febf97b8b04381c64adb0740bef5d8f6d65977cea4295d51758607924120/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230302d627269676874677265656e2e7376673f7374796c653d666c6174)[![Maintainability](https://camo.githubusercontent.com/20953ce6b22c43022462522f11b03eff4f319aa1243ba95151f3770f444951a0/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f63646131663164383864386337663461656134392f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/canax/configure/maintainability)[![Codacy Badge](https://camo.githubusercontent.com/fef9134c1fd43a0342a16052efeefba22229c07f0f6a05c4845fbcb56c492883/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3739643065616230663632373432346461353838623462333963666339663137)](https://www.codacy.com/app/mosbth/configure?utm_source=github.com&utm_medium=referral&utm_content=canax/configure&utm_campaign=Badge_Grade)

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
-------

[](#install)

```
$ composer require anax/configure
```

Related classes
---------------

[](#related-classes)

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

ClassPurposeConfigurationRead configuration files and store in array.Use as DI service
-----------------

[](#use-as-di-service)

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

Sample usage
------------

[](#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)

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

File/pathWhat`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-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
----------

[](#dependency)

There are no dependencies.

License
-------

[](#license)

This software carries a MIT license. See [LICENSE.txt](LICENSE.txt) for details.

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

```

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~86 days

Recently: every ~208 days

Total

16

Last Release

1948d ago

Major Versions

v1.0.5 → v2.0.0-alpha.12018-08-01

PHP version history (3 changes)v1.0.0PHP &gt;=5.6

v2.0.0-alpha.1PHP &gt;=7.2

v2.0.0-beta.1PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4cac244120f54c02a4fb3186b91323f3f0805dd9daefd0babeb4a82a19232faf?d=identicon)[mikael\_roos](/maintainers/mikael_roos)

---

Top Contributors

[![mosbth](https://avatars.githubusercontent.com/u/169550?v=4)](https://github.com/mosbth "mosbth (31 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

frameworkmvcboilerplateeducation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anax-configure/health.svg)

```
[![Health](https://phpackages.com/badges/anax-configure/health.svg)](https://phpackages.com/packages/anax-configure)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
