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

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

mizmoz/config
=============

Mizmoz Config

1.0.0(1y ago)0841MITPHPPHP &gt;=8.3

Since Aug 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mizmoz/config)[ Packagist](https://packagist.org/packages/mizmoz/config)[ Docs](https://www.mizmoz.com/)[ RSS](/packages/mizmoz-config/feed)WikiDiscussions master Synced yesterday

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

[Mizmoz](https://www.mizmoz.com/) / Config
==========================================

[](#mizmoz--config)

Aims
----

[](#aims)

- Be lightweight
- Configs are just php files which return arrays
- Environment set using .environment file
- Overridable by environment variables
- Lazy load config files

Getting Started
---------------

[](#getting-started)

### Composer Installation

[](#composer-installation)

```
composer require mizmoz/config

```

### Basic Usage

[](#basic-usage)

##### Set the environment

[](#set-the-environment)

Create a file in the root of the project called .environment which should contain the current platform

To set as development:

`echo 'development' > /my/project/root/.environment`

Alternatively use system environment

`export ENVIRONMENT=development`

##### Load a configuration from an array

[](#load-a-configuration-from-an-array)

```
$config = new Config(['app' => ...]);
$config->get('app...');
```

##### Load configuration from a directory of configs

[](#load-configuration-from-a-directory-of-configs)

```
$config = Config::fromDirectory('./config', '.php');
$config->get('app...');
```

##### Load configuration from a directory whilst handling different environments

[](#load-configuration-from-a-directory-whilst-handling-different-environments)

```
# In a config db.php
return [
    'type' => 'mongo',
    'hostname' => 'db.servers.com',
];

# In another config file for development db.development.php
return \Mizmoz\Config\Extend::production('db', [
    'host' => 'localhost',
]);

# Setup the config from directory
$config = Config::fromEnvironment(Environment::create(__DIR__));
$config->get('db.type'); // mongo
$config->get('db.hostname'); // localhost
```

##### Override the config values

[](#override-the-config-values)

```
# Using the envrionment override to ensure any values that come from the environment variables are treated as priority
# Assuming we do something like:
# export MM_DB_PORT=3333
$config = new Config([
    'db' => [
        'default' => 'mysql',
        'port' => 3306,
    ]
]);

$config->addOverride(new Env);

# Access the value of 3333
$config->get('db.port');
```

```
# The same can be done for cli arguments so:
# php my-script.php MM_DB_PORT=5555
$config = new Config([
    'db' => [
        'default' => 'mysql',
        'port' => 3306,
    ]
]);

$config->addOverride(new Args);

# Access the value of 5555
$config->get('db.port');
```

```
# These can be chained with last priority so using the above example:
# Returns 5555
$config->addOverride(new Env)
    ->addOverride(new Args)
    ->get('db.port');
```

##### Accessing the configs

[](#accessing-the-configs)

```
$config = new Config([
    'db' => [
        'default' => 'mysql',
        'mysql' => 3306,
    ]
]);

# Basic accessing using dot notation
$config->get('db.default');

# Using the __invoke magic method
$config('db');

# Accessing with other config values referenced
$config->get('db.${db.default}');

# Accessing with relative references
$config->get('db.${.default}');
```

Roadmap
-------

[](#roadmap)

- Add support for duplicating values such as website address which might be re-used for multiple params.
    - Need to figure out a way to do this without introducing any significant overhead when returning a config tree

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 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 ~518 days

Recently: every ~647 days

Total

6

Last Release

642d ago

Major Versions

0.5.0 → 1.0.02024-09-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/733223?v=4)[Ian Chadwick](/maintainers/ianchadwick)[@ianchadwick](https://github.com/ianchadwick)

---

Top Contributors

[![ianchadwick](https://avatars.githubusercontent.com/u/733223?v=4)](https://github.com/ianchadwick "ianchadwick (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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