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

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

affinity4/config
================

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

3.0.0(4y ago)128[1 PRs](https://github.com/affinity4/config/pulls)MITPHPPHP &gt;=8.0CI failing

Since Jan 11Pushed 5mo ago2 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (11)Used By (0)

Config
======

[](#config)

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

Features
--------

[](#features)

- Specify any Loader which implements Affinity4\\Config\\LoaderInterface
- Get entire array of values
- Get specific value using simple, readable pattern

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

[](#installation)

Affinity4/Config is available via composer:

```
composer require affinity4/config
```

Usage
-----

[](#usage)

Given the contents of `config.yml` are:

```
env: local
db:
    local:
        name: test
        user: root
        pass: root
        host: 127.0.0.1
```

Using the Affinity4 Yaml Loader:

```
$loader = new Affinity4\Config\Loader\Yaml(__DIR__ . '/config.yml');

$config = new Affinity4\Config\Config($loader);
```

Get complete array using the `get()` method without passing a key:

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

Would return:

```
[
    'env' => 'local',
    'db' => [
        'local' => [
            'name' => 'test',
            'user' => 'root',
            'pass' => 'root',
            'host' => '127.0.0.1',
        ]
    ]
]
```

Or get a specific value by specifying a the map to the nested key:

```
$config->get('db local name'); // test
```

Loaders
-------

[](#loaders)

Affinity4/Config comes with these Loaders out of the box:

- Json
- Yaml
- Neon
- PHP

Tests
-----

[](#tests)

Run tests:

```
vendor/bin/phpunit
```

Licence
-------

[](#licence)

(c) 2017 Luke Watts (Affinity4.ie)

This software is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance50

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~280 days

Recently: every ~459 days

Total

8

Last Release

1497d ago

Major Versions

1.1.4 → 2.0.02019-06-18

2.0.0 → 3.0.02022-05-25

PHP version history (4 changes)1.0.0PHP &gt;=5.6

1.1.3PHP &gt;=7.0

2.0.0PHP &gt;=7.1

3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8245712?v=4)[Affinity4](/maintainers/Affinity4)[@affinity4](https://github.com/affinity4)

---

Top Contributors

[![lukewatts](https://avatars.githubusercontent.com/u/4622166?v=4)](https://github.com/lukewatts "lukewatts (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

configconfiguration-filesconfiguration-managementphp

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k45](/packages/friendsoftypo3-content-blocks)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1175.2k](/packages/rcsofttech-audit-trail-bundle)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

43785.5k4](/packages/lullabot-drainpipe)[altis/local-server

Local Server module for Altis

18217.0k2](/packages/altis-local-server)

PHPackages © 2026

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