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

ActiveLibrary

earthit/config-loader
=====================

Gives access to structured config values in files or environment variables

1.0.0(8y ago)022MITPHPPHP &gt;=5.2

Since Oct 19Pushed 8y ago5 watchersCompare

[ Source](https://github.com/EarthlingInteractive/PHPConfigLoader)[ Packagist](https://packagist.org/packages/earthit/config-loader)[ RSS](/packages/earthit-config-loader/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

PHP Config Loader
=================

[](#php-config-loader)

Gives access to structured configuration variables stored in JSON files and/or environment variables.

Example
-------

[](#example)

Let's say `config/database.json` looks like:

```
{
	"driver": "postgres",
	"host": "db.example.org",
	"dbname": "OVERRIDE ME PLZ THX",
	"notes": [
		"This is the greatest database configuration.",
		"My brother Bob said so."
	]
}
```

And we're going to run our PHP script with these environment variables:

```
database_dbname=bobco
otherthing_json='{"foo":"bar","baz","quux"}'
otherthing_foo="jk actually not bar"
```

And then we have a script like:

```
$loader = new EarthIT_ConfigLoader( 'database', $_ENV )
echo "Database: "; var_export($loader->get('database'));
echo "Other thing: "; var_export($loader->get('otherthing'));
```

Would output something like:

```
Database: array (
  driver => 'postgres',
  host => 'db.example.org',
  dbname => 'bobco',
  notes => array (
    'This is the greatest database configuration.',
    'My brother Bob said so.'
  )
)
Other thing: array (
  'foo' => 'jk actually not bar',
  'baz' => 'quux'
)

```

### Overrides

[](#overrides)

Variables are merged in the following order, with later steps 'overriding' the values from earlier steps:

- JSON files
- files in subdirectories (e.g. 'foo/bar.json' can override 'bar' from 'foo.json')
- JSON-encoded environment variables
- Leaf environment variables

If an array value overrides another array value, they are merged instead of replacing the old one.

### Environment variable names

[](#environment-variable-names)

- Underscores have special meaning, so if you have a variable `foo_bar_baz=42`, it's going to show up when fetched from the ConfigLoader as `array('foo'=>array('bar'=>array('baz'=>42)))`
- The postfix `json` also has special meaning. It means that the value of the variable named by the part before "\_json" will be determined by JSON-decoding this environment variable's value.

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3077d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84f2846fb867825e6831a99f7ba5ca9301de56a424928e2c494f81c2c6061677?d=identicon)[TOGoS](/maintainers/TOGoS)

---

Top Contributors

[![TOGoS](https://avatars.githubusercontent.com/u/57142?v=4)](https://github.com/TOGoS "TOGoS (3 commits)")

### Embed Badge

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

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

PHPackages © 2026

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