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

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

abreksa4/mini-config
====================

A mini config library

0.2(10y ago)057proprietaryPHP

Since Nov 11Pushed 10y agoCompare

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

READMEChangelog (3)DependenciesVersions (3)Used By (0)

mini-config
===========

[](#mini-config)

mini-config takes a list of files and directories, and becomes an ArrayAccess object with the parsed config data.

Currently supports JSON\*, INI, PHP arrays, and XML\*\* out of the box.

\**JSON must be in the following format, though you can register a custom JSON parser to override this:*

```
{
  "cat1": {
    "key1": "value1",
    "key2: "value2"
  },
  "cat2": {
    "key1": 0
  }
}

```

\*\**XML must be in the following format, though you can register a custom XML parser to override this:*

```

    value

        value

```

Documentation is available at:

mini-config merges the config data recursively. (Meaning that if two sources (files) share keys, the values will be merged as an array as well.)

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

[](#installation)

Add this to your composer.json

```
{
    "require": {
        "abreksa4/mini-config": "0.2"
    }
}

```

Usage
-----

[](#usage)

### Create a new Config instance

[](#create-a-new-config-instance)

Create a new Config instance, passing in the optional $options array, which currently supports the keys 'targets' which should contain an array of targets, and 'handlers' an array of handlers in the format \[$extension =&gt; $handler\].

```
$config = new Config([
    'targets' => [
        'module/config.xml',
        'config',
        ]
    ],
    'handlers' => array(
        'yml' => function ($file) { return yaml_parse_file($file); }
    )
));

```

At this point the `$config` object is up and running, with the data from the files in `config`, and in `module/config.xml`. (Note, we'd need to have the YAML PHP extension installed to use `yaml_parse`.)

### Add more targets

[](#add-more-targets)

We can add more targets by calling `addTarget`. As you can see we can either add an array of targets or just one.

```
$config->addTarget('/anothermodule/config');
$config->addTarget(['config_ini', '../config/local']);

```

### Custom handlers

[](#custom-handlers)

You can register a custom handler for any file extension. For example:

```
$config->registerHandler(['yml'],
       function($file){
            return yaml_parse_file($file);
       }
);

```

Notice we can register an array of extensions to one handler, we can also specify a single extension as a string. Extensions are case-sensitive.

### Merge array into config

[](#merge-array-into-config)

```
$config->merge([
    'cat3'=> [
        'key1' => 'value1';
    ]
]);

```

### Refreshing the config

[](#refreshing-the-config)

Instead of re-scanning and importing all the data every time we add a target, we call the `refresh()` method to re-import the data:

```
$config->refresh();

```

### Data access

[](#data-access)

We can access the data by treating the `$config` object as an array, i.e.

```
$config['database']['password'];

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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

Every ~0 days

Total

2

Last Release

3888d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/881e86700b490ed77a8be2ab32ba3179ca7188a2e6bd94a0f2115eb2ed2c1ca2?d=identicon)[abreksa4](/maintainers/abreksa4)

---

Top Contributors

[![abreksa4](https://avatars.githubusercontent.com/u/6120041?v=4)](https://github.com/abreksa4 "abreksa4 (32 commits)")

### Embed Badge

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

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

PHPackages © 2026

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