PHPackages                             openlss/lib-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. openlss/lib-config

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

openlss/lib-config
==================

Configuration access helper and environment manager

0.0.15(12y ago)047.2k↓19.3%8LGPL-3.0+PHPPHP &gt;=5.3.2

Since Mar 23Pushed 12y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (17)Used By (8)

openlss/lib-config
==================

[](#openlsslib-config)

Configuration access helper and environment manager

Usage
-----

[](#usage)

```
//build config
$config = array();
$config['test1'] = 'test';
$config['test2']['sec'] = 'test';
$config['test3']['sec'] = 'test2';

//load config
Config::setConfig($config); unset($config);

//set an additional
Config::set('test2.newsec',null,'testvalue');

//get options
$test = Config::get('test1');
$test2 = Config::get('test2.sec');
$test3 = Config::get('test2.newsec');

//get merged
$db = Config::getMerged('sec'); //will return test2
```

Singleton
---------

[](#singleton)

Config operates with an internal singleton even though all the methods are static.

To retrieve the singleton use the following

```
//use the clone keyword to actually copy the object (this is optional)
$inst = clone Config::_get();

//load up a new temporary config
Config::setConfig($newconfig);

//restore the old config
Config::$inst = clone $inst; unset($inst);
```

Reference
---------

[](#reference)

### (object) \_get()

[](#object-_get)

Returns the current singleton (will create one if it doesnt exist)

### (void) setConfig($config)

[](#void-setconfigconfig)

Will set the passed array to the main config This will merge with the existing config

### (void) resetConfig($config)

[](#void-resetconfigconfig)

Resets the internal config registry

### (void) dumpConfig($config)

[](#void-dumpconfigconfig)

var\_dumps the internal config Note: use output buffers to capture this

### (void) setDefaults($config)

[](#void-setdefaultsconfig)

Made to be used by packages will set the passed config below the internal config Example:

```
self::_get()->config = array_merge($config,self::_get()->config);
```

This allows userspace overrides to remain in affect regardless of registration time.

### (mixed) set($sec,$name,$value)

[](#mixed-setsecnamevalue)

Sets a value in the config

- $sec config section (can be an MDA key) NULL for none
- $name config name (can be an MDA key) NULL for none
- $value Value to be set Returns the value to be set

### (bool) exists($sec,$name=null)

[](#bool-existssecnamenull)

Check if a value exists

- $sec config section (can be an MDA key) NULL for none
- $name config name (can be an MDA key) NULL for none

### (mixed) get($sec=null,$name=null)

[](#mixed-getsecnullnamenull)

Get a value from the confi structure

- $sec config section (can be an MDA key) NULL for none
- $name config name (can be an MDA key) NULL for none

### (mixed) getMerged($sec,$name=null)

[](#mixed-getmergedsecnamenull)

Get a merged value from the config tree Consider the following config structure

```
//full tree
$config['db']['driver'] = 'mysql';
$config['admin']['db']['driver'] = 'sqlite3';

Config::setConfig($config);
$val = Config::getMerged('admin','db.driver'); //returns 'sqllite'

//shorthand tree
$config['db']['driver'] = 'mysql';

Config::setConfig($config);
$val = Config::getMerged('admin','db.driver'); //returns 'mysql'
```

The idea is to retrieve a section from a subroot and gracefully look upstream.

- $sec config section (can be an MDA key) NULL for none
- $name config name (can be an MDA key) NULL for none

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~12 days

Recently: every ~39 days

Total

15

Last Release

4634d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c8e9d55e3ebafb0621a441a51af8f551f61a274fde5400459a29cc320b7b75?d=identicon)[nullivex](/maintainers/nullivex)

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

---

Top Contributors

[![nullivex](https://avatars.githubusercontent.com/u/2321375?v=4)](https://github.com/nullivex "nullivex (20 commits)")[![Spudz76](https://avatars.githubusercontent.com/u/2391234?v=4)](https://github.com/Spudz76 "Spudz76 (3 commits)")[![doyjo](https://avatars.githubusercontent.com/u/3947855?v=4)](https://github.com/doyjo "doyjo (1 commits)")

---

Tags

configurationconfigconfig overridesystem configuration

### Embed Badge

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

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

###  Alternatives

[symfony/options-resolver

Provides an improved replacement for the array\_replace PHP function

3.2k493.9M1.6k](/packages/symfony-options-resolver)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[dflydev/dot-access-configuration

Given a deep data structure representing a configuration, access configuration by dot notation.

13414.5M4](/packages/dflydev-dot-access-configuration)[dmishh/settings-bundle

Database centric Symfony configuration management. Global and per-user settings supported.

115254.9k1](/packages/dmishh-settings-bundle)[caseyamcl/configula

A simple, but versatile, PHP config loader

42146.6k6](/packages/caseyamcl-configula)[illuminatech/array-factory

Allows DI aware object creation from array definition

2159.6k6](/packages/illuminatech-array-factory)

PHPackages © 2026

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