PHPackages                             aloframework/config - 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. aloframework/config

ActiveLibrary

aloframework/config
===================

Allows easy, interfaceable class configurator with the ability to change the configuration during runtime

2.0.1(9y ago)04004Apache-2.0PHPPHP &gt;=5.4

Since Oct 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/aloframework/config)[ Packagist](https://packagist.org/packages/aloframework/config)[ Docs](https://github.com/aloframework/config)[ RSS](/packages/aloframework-config/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (4)

AloFramework | Config
=====================

[](#aloframework--config)

A component that allows easy object configuration with default and overriding settings

Latest release API documentation:

[![License](https://camo.githubusercontent.com/de033be976c4a62d73ba7a88dff2856f34229912d1e09f43982895196dd9567f/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6672616d65776f726b2f636f6e6669672f6c6963656e73653f666f726d61743d706c6173746963)](https://camo.githubusercontent.com/de033be976c4a62d73ba7a88dff2856f34229912d1e09f43982895196dd9567f/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6672616d65776f726b2f636f6e6669672f6c6963656e73653f666f726d61743d706c6173746963)[![Latest Stable Version](https://camo.githubusercontent.com/8779ca90d9a3ff2af1222b73170bfef99e1e8815aa7a9e0ef39cc199530c5629/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6672616d65776f726b2f636f6e6669672f762f737461626c653f666f726d61743d706c6173746963)](https://packagist.org/packages/aloframework/config)[![Total Downloads](https://camo.githubusercontent.com/8fcbb4a74079342e88b559ed04817d51f59ce5dadf0dc224758378c2ef57ec73/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6672616d65776f726b2f636f6e6669672f646f776e6c6f6164733f666f726d61743d706c6173746963)](https://packagist.org/packages/aloframework/config)

dev-developLatest release[![Dev Build Status](https://camo.githubusercontent.com/4d8b0a0118e8e05d5c75f6df515527b3f4f12528ea6c28f88ed1733f901ea030/68747470733a2f2f7472617669732d63692e6f72672f616c6f6672616d65776f726b2f636f6e6669672e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/aloframework/config)[![Release Build Status](https://camo.githubusercontent.com/2a3db57195cc75e2cba1eae57266319889c0b224e84d4f50d6d863fa68318ec0/68747470733a2f2f7472617669732d63692e6f72672f616c6f6672616d65776f726b2f636f6e6669672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aloframework/config)[![Coverage Status](https://camo.githubusercontent.com/528b1640375ad82f64a7ad1afbc9699a2439a804d705312620b6d15430fe7de8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f616c6f6672616d65776f726b2f636f6e6669672f62616467652e7376673f6272616e63683d646576656c6f7026736572766963653d676974687562)](https://coveralls.io/github/aloframework/config?branch=develop)[![Coverage Status](https://camo.githubusercontent.com/039272ea04c4c09eb370c44d73b3050cfa3612d43f8e9d35400ef9daea441e4a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f616c6f6672616d65776f726b2f636f6e6669672f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/aloframework/config?branch=master)Installation
------------

[](#installation)

Installation is available via Composer:

```
composer require aloframework/config

```

The abstract class
------------------

[](#the-abstract-class)

`AloFramework\Config\AbstractConfig` is what your own library configurations should extend. It has three main private properties: `$defaults` holding default configuration, `$custom` holding custom configuration/overrides and `$merged`, which holds the actual configuration that will be used. Your overriding config class will populate the default array and accept any custom variables in the constructor, e.g.:

```
use AloFramework\Config\AbstractConfig;

class MyConfig extends AbstractConfig {

    private static $defaultConfig = ['foo'          => 'bar',
                                     'importantVar' => 'andItsValue'];

    function __construct($customConfig = []) {
        parent::__construct(self::$defaultConfig, $customConfig);
    }
}

```

When reading the configuration, the values are fetched from the `$merged` array, which is essentially an `array_merge($this->defaults, $this->custom)`. For more information refer to the API documentation above.

The interface
-------------

[](#the-interface)

You can implement the `AloFramework\Config\Configurable` interface in your configuration-reading class to indicate that its runtime settings can be altered using this package. The trait described below can be used to implement the required methods.

The trait
---------

[](#the-trait)

If you don't want to write your own methods you can simply include the provided `AloFramework\Config\ConfigurableTrait` which will implement all the methods required by the interface.

Updating the configuration
--------------------------

[](#updating-the-configuration)

### Setting an item

[](#setting-an-item)

You can add a custom configuration key or default setting override by calling `$config->set('myKey', 'myValue')`, using `__set()` like `$config->myKey = 'myValue'`, or simply using it like an array: `$config['myKey'] = 'myValue'`.

### Removing an item

[](#removing-an-item)

You can remove **custom** configuration via `$config->remove('myKey')`, or by unsetting it like an array value: `unset($config['myKey']);`

Reading the configuration
-------------------------

[](#reading-the-configuration)

### Specific value

[](#specific-value)

You can retrieve a specific configuration item from the merged array by calling `$config->get('myKey')`, using `__get()` like `$config->myKey` or by using the object like an array: `$config['myKey']`.

### The merged config

[](#the-merged-config)

You can retrieve the merged array via `$config->getAll()`

### The default config

[](#the-default-config)

For this you would use `$config->getDefaultConfig()`

### The custom overrides

[](#the-custom-overrides)

For this you would use `$config->getCustomConfig()`.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~80 days

Recently: every ~98 days

Total

6

Last Release

3469d ago

Major Versions

1.1 → 2.02016-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/cca267ade0c44a740c602ca62e377789418696ad942cbd1e3d59100b9928f1a2?d=identicon)[Alorel](/maintainers/Alorel)

---

Top Contributors

[![Alorel](https://avatars.githubusercontent.com/u/4998038?v=4)](https://github.com/Alorel "Alorel (20 commits)")

---

Tags

phpconfigurationconfiginterface5.4AloFramework

### Embed Badge

![Health badge](/badges/aloframework-config/health.svg)

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

###  Alternatives

[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

69124.2k1](/packages/m1-vars)[romanpitak/nginx-config-processor

Nginx configuration files processor.

7235.3k1](/packages/romanpitak-nginx-config-processor)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)

PHPackages © 2026

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