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

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

marek-baron/config
==================

Lightweight PHP configuration library.

v0.1.0(3mo ago)13MITPHPPHP ^8.1CI passing

Since Oct 22Pushed 3mo agoCompare

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

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

marek-baron/config
==================

[](#marek-baronconfig)

[![CI](https://github.com/marek-baron/config/actions/workflows/ci.yml/badge.svg)](https://github.com/marek-baron/config/actions)

Lightweight, dependency-free PHP configuration library.

Features
--------

[](#features)

- Simple key access using dot notation (db.host)
- Immutable config (with() returns a cloned instance)
- Merge multiple config sources via ConfigAggregator
- Provider support for files, callables, classes, or arrays
- No external dependencies

Installation
------------

[](#installation)

composer require marek-baron/config

Config example
--------------

[](#config-example)

```
$config = new Config([
'db' => ['host' => 'localhost', 'port' => 3306],
'app' => ['debug' => false],
]);

echo $config->get('db.host');
$newConfig = $config->with('app.debug', true); //Immutable!

var_dump($config->get('app.debug'));     // false
var_dump($newConfig->get('app.debug'));  // true
```

ConfigAggregator example
------------------------

[](#configaggregator-example)

```
use MarekBaron\Config\ConfigAggregator;

$aggregator = new ConfigAggregator([
    __DIR__ . '/config/global.php',
    __DIR__ . '/config/local.php',
    fn() => ['cache' => ['enabled' => true]],
]);

$config = $aggregator->load();

echo $config->get('cache.enabled'); // true
```

ConfigProviderInterface example

```
namespace App\Domain\Module;

use MarekBaron\Config\ConfigProviderInterface;

class ConfigProvider implements ConfigProviderInterface
{
    public function __invoke(): array
    {
        return [
            'factories' => [
                UserLoginHandler::class => UserLoginHandlerFactory::class,
            ],
            'routes' => [
                // your routes
            ],
            // anything else
        ];
    }
}
```

Development (optional)
----------------------

[](#development-optional)

A Dockerfile and docker-compose.yml are included for local development. They are excluded from Packagist via .gitattributes.

```
docker compose run --rm config-dev composer check
```

License
-------

[](#license)

MIT License © Marek Baron

[![PHPUnit](https://github.com/marek-baron/config/actions/workflows/ci.yml/badge.svg)](https://github.com/marek-baron/config/actions)[![Packagist](https://camo.githubusercontent.com/0a810bd99676ed8205ebd3e780f4efc5a1e8d394c8aab4ebda3814ed7273b10b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6172656b2d6261726f6e2f636f6e6669672e737667)](https://packagist.org/packages/marek-baron/config)[![License](https://camo.githubusercontent.com/df2505cf240dddd29d3d6840e108e590d06fb86a053112e2493fe5f36c89783e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6172656b2d6261726f6e2f636f6e6669672e737667)](LICENSE)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance81

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

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

Total

2

Last Release

100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cac6562d9d5c42c1dbc5c69fcf68367441f14389bc118f0cc2be1c9e02a4b9f8?d=identicon)[marek-baron](/maintainers/marek-baron)

---

Top Contributors

[![marek-baron](https://avatars.githubusercontent.com/u/47612293?v=4)](https://github.com/marek-baron "marek-baron (9 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[panakour/analytics

Get whatever data you want from google analytics.

267.6k](/packages/panakour-analytics)[kakuilan/php-helper

k`s php helper/library/utils

314.8k3](/packages/kakuilan-php-helper)[seanstewart/plan-config

Plan config allows you to easily define attributes and limits for your SaaS application subscription plans.

314.0k](/packages/seanstewart-plan-config)[damodar-bhattarai/settings

Package to store and get general website settings on the fly.

312.2k](/packages/damodar-bhattarai-settings)

PHPackages © 2026

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