PHPackages                             monomelodies/kingconf - 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. monomelodies/kingconf

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

monomelodies/kingconf
=====================

Load configuration in any sane format

1.1.5(6y ago)02.3k[1 PRs](https://github.com/monomelodies/kingconf/pulls)2MITPHPPHP &gt;=7.2CI passing

Since Dec 2Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (13)Used By (2)

Kingconf
========

[](#kingconf)

Load configuration in any sane format

Some prefer JSON, some prefer YAML. Some even prefer XML... why not allow them all and let the user decide?

`Kingconf` loads configuration from any of the following formats:

- `json`: A JSON as a key/value store.
- `yaml`: A Yaml file.
- `xml`: An XML file. It should contain a root element which can be called anything.
- `ini`: The PHP .ini format.
- `php`: Plain ol' PHP (`return ['key' => 'value']` format).

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

[](#installation)

### Composer (recommended)

[](#composer-recommended)

```
$ cd /path/to/project
$ composer require monomelodies/kingconf
```

### Manual

[](#manual)

- Download or clone the repository somewhere;
- Add `/path/to/kingconf/src` to your autoloader for PSR-4 namespace `Monomelodies\\Kingconf\\`.

Usage
-----

[](#usage)

Create a `Monomelodies\Kingconf\Config` object with one or more config file paths as the constructor arguments:

```
