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

AbandonedArchivedLibrary

pinepain/simple-config
======================

Lightweight and flexible library for configuration management

v0.0.2(10y ago)55301MITPHPPHP &gt;=5.4.0

Since Aug 6Pushed 8y ago3 watchersCompare

[ Source](https://github.com/pinepain/php-simple-config)[ Packagist](https://packagist.org/packages/pinepain/simple-config)[ Docs](https://github.com/pinepain/php-simple-config)[ RSS](/packages/pinepain-simple-config/feed)WikiDiscussions master Synced 1mo ago

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

WARNING: This project is UNSUPPORTED and ABANDONED
==================================================

[](#warning-this-project-is-unsupported-and-abandoned)

Php Simple Config
=================

[](#php-simple-config)

[![Build Status](https://camo.githubusercontent.com/413c9a7f702e77c88aa91b77e195c00b66b2a0ada94ab99c7b0da55a128717fe/68747470733a2f2f7472617669732d63692e6f72672f70696e657061696e2f7068702d73696d706c652d636f6e6669672e737667)](https://travis-ci.org/pinepain/php-simple-config)

About
=====

[](#about)

This is yet another library to deal with Config values. It designed to be obvious, minimal, lightweight, fast and extensible.

This library combines approaches used by well-known and recognizable PHP (and not limited to) frameworks.

Features:
---------

[](#features)

- obvious and simple
- dealing with config best practices
- default values for missed items support
- flexibility (yeah, someone may say that it is so flexible that you have to give it a support)
- minimal and extensible codebase
- designed to have lose coupled code (at least wannabe)
- speed (one of fastest from all what you've ever seen, marketing guys may add "close to bare metal", but that is not true as all we know)

Installation:
-------------

[](#installation)

`composer require pinepain/simple-config 0.*`

Configs loading:
----------------

[](#configs-loading)

As this library tries to keep things simple, `Config` class requires only array of config items, so you may have any configs loading logic you want and your application needs.

Right out of the box there are `FilesLoader` configs loade which simply `require`'s all files in single directory and store returned items in config array under file's basename (file name without path to it and its extension) key.

Limitation:

- Nested configs loading (that one that reside in nested directories) are not supported.
- Dot-file (that one that starts with dot(`.`) character) and files that have different than `.php` extension are ignored.
- Files with dots in base name (name without path and extension) are not supported (see note below why).

Assume, we have such directory tree:

```
example/config
├── .dotfile.php
├── app.php
├── cache.php
├── db.php
├── mail.php.old
└── somedir/
    └── somefile.php

```

then loading configs from `config` directory will load only `app.php`, `cache.php` and `db.php` files and **will ignore**`.dotfile.php` and `mail.php.old` files and will skip `somedir/` content completely.

### Note:

[](#note)

Files with dots in it names (not counting dot between basename and extension) will leads to undiscoverable config section, e.g. config file `db.old.php` will be interpreted as `[ 'db.old' => ... ]` entry which can't be accessed via dot notation while we assume that each dot means one nested level.

While having such config section is ambiguous such naming is not supported by this library.

Example:
--------

[](#example)

```
