PHPackages                             masnathan/config4all - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. masnathan/config4all

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

masnathan/config4all
====================

This class helps you load your application configs, it supports php, xml, ini and json files.

2.2.0(9y ago)11711MITPHPPHP &gt;=5.3.0

Since Oct 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/MASNathan/Config4all)[ Packagist](https://packagist.org/packages/masnathan/config4all)[ Docs](https://github.com/MASNathan/Config4all)[ RSS](/packages/masnathan-config4all/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (6)Versions (8)Used By (0)

Config4all
==========

[](#config4all)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b242beb650bbdf006e894cb70cbb089a819f4b71625723099f377252815b8c05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61736e617468616e2f636f6e66696734616c6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/masnathan/config4all)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/fc1f90c1d2dfe65501d68e6044b7e177d46b485da2e72b5af3d80e1e32abcc66/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4d41534e617468616e2f436f6e66696734616c6c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/MASNathan/Config4all)[![Coverage Status](https://camo.githubusercontent.com/ee809a3cbcc49ecbbca70306498a0a175729503f7a585af5863fd2223c5b76e6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d61736e617468616e2f636f6e66696734616c6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/masnathan/config4all/code-structure)[![Quality Score](https://camo.githubusercontent.com/891739c2a57a50f917c7a1b8b89f1739e3b24f7fb2b9f048be8e5a7153d18616/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d61736e617468616e2f636f6e66696734616c6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/masnathan/config4all)[![Total Downloads](https://camo.githubusercontent.com/159b72125dbad16abe9667136cbcc8610d8f5ff91e7b89dc0cdb1e0a3f669be1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61736e617468616e2f636f6e66696734616c6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/masnathan/config4all)[![Support via Gittip](https://camo.githubusercontent.com/4bbca1e96ec562170a4c102b39351010db191496d227064c30423adb5f03ac36/68747470733a2f2f696d672e736869656c64732e696f2f6769747469702f52656944754b756475726f2e7376673f7374796c653d666c61742d737175617265)](https://gratipay.com/~ReiDuKuduro/)

This class helps you load your application configs, it supports php, xml, ini, yml, neon and json files.

It's easy to use, and you can load multiple files with diferent formats at once

Install
-------

[](#install)

Via Composer

```
$ composer require masnathan/config4all
```

Usage
-----

[](#usage)

```
use MASNathan\Config\Config;

$config = new Config();

//You can load as many files as you want, one by one
$config->load('configs/config.php', 'configs/database.php');
//or all the files with a certain extension at the same time
$config->load('configs/*.json');
//you can even load multiple format files at the same time
$config->load('configs/*.json', 'configs/*.yml');
//or can also load multiple files, regardless of the extension
$config->load('configs/*.*');

//This is how you clear all the configurations
$config->clear();
```

\##Fetching the information

```
//To get a value, you just need to know the path to get there
//if you want to know my name, just use the get method and pass the configuration file name
//and the keys to get my name, like this
echo $config->get('config', 'me', 'name');

//here are some other examples
echo $config->get('config', 'github');
echo $config->get('database', 'host');

//if the value that you are trying to get doesn't exist, you'll get a null
//you can also get the entire structure by calling the method get with no arguments
var_dump($config->get());
```

\##Setting my own configs

```
//You can also set new configs on the fly, or change existing ones
$config
    ->set('a', 'b', 'c', 'value')
    ->set('config', 'me', 'name', 'Not Andre Filipe')
    ->set('database', 'host', 'first', 'localhost')
    ->set('database', 'host', 'second', 'somehost')
    ->set('this is a null field');

//This will return 'value'
echo $config->set('a', 'b', 'c');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [André Filipe](https://github.com/masnathan)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~234 days

Total

7

Last Release

3509d ago

Major Versions

1.0.1 → 2.0.02014-03-09

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2139464?v=4)[André Filipe](/maintainers/MASNathan)[@MASNathan](https://github.com/MASNathan)

---

Top Contributors

[![MASNathan](https://avatars.githubusercontent.com/u/2139464?v=4)](https://github.com/MASNathan "MASNathan (28 commits)")

---

Tags

configjsonphpyamlphpjsonxmlconfigyamlneon

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/masnathan-config4all/health.svg)

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

###  Alternatives

[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

69124.2k1](/packages/m1-vars)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)[phppkg/config

Config manage, load, get. Supports INI,JSON,YAML,NEON,PHP format file

133.5k](/packages/phppkg-config)

PHPackages © 2026

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