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

ActiveLibrary

myerscode/config
================

A package for compiling multi file, cross referencing configuration files

2026.0.0(1mo ago)1685MITPHPPHP ^8.5CI passing

Since Aug 18Pushed 3w ago1 watchersCompare

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

READMEChangelog (1)Dependencies (17)Versions (16)Used By (0)

Config
======

[](#config)

> A PHP utility that creates a configuration object from multi file, cross-referencing php array maps or yaml files

[![Latest Stable Version](https://camo.githubusercontent.com/aee87eb585dd03b4c075fd20b42d3ab678214ca7458b236edfd325725c3064df/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f636f6e6669672f762f737461626c65)](https://packagist.org/packages/myerscode/config)[![Total Downloads](https://camo.githubusercontent.com/ec658a1a5560c82e39cef68b0ba13ebc4afc8011e83919ede1630f25aa49a3a8/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f636f6e6669672f646f776e6c6f616473)](https://packagist.org/packages/myerscode/config)[![PHP Version Require](https://camo.githubusercontent.com/e985a7cbd06f5693c4ee6beaae00255145fa1b4709f806176531fa41f377376e/687474703a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f636f6e6669672f726571756972652f706870)](https://packagist.org/packages/myerscode/config)[![License](https://camo.githubusercontent.com/02f39c78c58be0d40bf900bffbc2d740490bf87d2e40d1c77bfc6aa775b5ecc7/68747470733a2f2f706f7365722e707567782e6f72672f6d79657273636f64652f636f6e6669672f6c6963656e7365)](https://github.com/myerscode/config/blob/main/LICENSE)[![Tests](https://github.com/myerscode/config/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/myerscode/config/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/0d6799c7038165ba348f3ce6e82f4d9bfeff5b9105ee0904cb15a12b1d2627ff/68747470733a2f2f636f6465636f762e696f2f67682f6d79657273636f64652f636f6e6669672f67726170682f62616467652e737667)](https://codecov.io/gh/myerscode/config)

Why this package is helpful?
----------------------------

[](#why-this-package-is-helpful)

This package will allow you to build a config object, that you can simply retrieve values from. You manage configuration across multiple PHP or YAML files, with the ability to cross-reference properties in order to build up complex values.

Install
-------

[](#install)

You can install this package via composer:

```
composer require myerscode/config
```

Requirements
------------

[](#requirements)

- PHP 8.5+

Usage
-----

[](#usage)

### Creating a Config Store

[](#creating-a-config-store)

To get started ll you need to do is you need to create a `Config` instance and start loading data into files into it.

```
$config = new Config();

$config->loadFiles([
'config/app.php',
'config/db.yaml',
]);

$config->loadFile('config/cache.php');

$config->loadData(['api_key' => 'abc123']);

// example config object
[
    'name' => 'myerscode',
    'db_name' => 'myerscode_db',
    'api_key' => 'abc123',
]
```

### Namespaced Configuration

[](#namespaced-configuration)

By default, config from files will be merged recursivly when loaded in. If you want to give each file a top level namespace call the `loadFilesWithNamespace` and `loadFileWithNamespace` methods to have each file be loaded into a namespace using their filename

```
$config = new Config();

$config->loadFilesWithNamespace([
'config/app.php',
'config/db.yaml',
]);

$config->loadFileWithNamespace('config/cache.php');

// example config object
[
    'app' => [...],
    'db' => [...],
    'cache' => [...],
]
```

### Retrieving a value

[](#retrieving-a-value)

Retrieve a single value from the store by using the `value` method and passing in a key.

Using `dot notation` you can access deep values of a config element, or retrieve the entire object by calling its top level namespace.

```
$config->value('app.name');

$config->value('app');

$config->value('api_key');
```

### Get all store value

[](#get-all-store-value)

Get all the values from the store as an array using the `values` method.

```
$config->values();
```

### Accessing the store

[](#accessing-the-store)

Accessing the values directly is done by calling the `store` method.

```
$store = $config->store();
```

Config Syntax
-------------

[](#config-syntax)

A basic config file, is a PHP file that will just return an array or a YAML file.

```
// app.config.php
return [
    'name' => 'Fred Myerscough',
    'settings' => [
        'a',
        'b',
        'c'
    ],
];
```

### Cross Referencing Values

[](#cross-referencing-values)

```
// app.config.php
return [
    'name' => 'myerscode',
    'env' => 'myerscode',
];

// db.config.php
return [
    'db' => [
        'setting' => [
            'name' => '${env}_${name}_db',
        ]
    ],
    'db_name' => '${db.config.name}'
];
```

Issues and Contributing
-----------------------

[](#issues-and-contributing)

We are very happy to receive pull requests to add functionality or fixes.

Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/myerscode/config/issues).

Please read the Myerscode [contributing](https://github.com/myerscode/docs/blob/main/CONTRIBUTING.md) guide for information on our Code of Conduct.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 98.7% 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 ~141 days

Recently: every ~224 days

Total

13

Last Release

38d ago

Major Versions

1.1.1 → 2025.0.02025-02-03

2025.0.0 → 2026.0.02026-04-10

PHP version history (4 changes)1.0.0PHP ^8.0

1.0.4PHP ^7.4|^8.0

2025.0.0PHP ^8.4

2026.0.0PHP ^8.5

### Community

Maintainers

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

---

Top Contributors

[![oniice](https://avatars.githubusercontent.com/u/2676321?v=4)](https://github.com/oniice "oniice (77 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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