Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vaibhavpandeyvpz/kunfig
Helper library to easily merge & use multiple configuration files.
https://github.com/vaibhavpandeyvpz/kunfig
Last synced: 4 days ago
JSON representation
Helper library to easily merge & use multiple configuration files.
- Host: GitHub
- URL: https://github.com/vaibhavpandeyvpz/kunfig
- Owner: vaibhavpandeyvpz
- License: mit
- Created: 2016-05-03T12:54:23.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-22T11:19:03.000Z (almost 8 years ago)
- Last Synced: 2024-05-03T16:40:25.681Z (6 months ago)
- Language: PHP
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# vaibhavpandeyvpz/kunfig
Helper library to easily merge & use multiple configuration files.[![Build status][build-status-image]][build-status-url]
[![Code Coverage][code-coverage-image]][code-coverage-url]
[![Latest Version][latest-version-image]][latest-version-url]
[![Downloads][downloads-image]][downloads-url]
[![PHP Version][php-version-image]][php-version-url]
[![License][license-image]][license-url][![SensioLabsInsight][insights-image]][insights-url]
Install
-------
```bash
composer require vaibhavpandeyvpz/kunfig
```Usage
-----
```php
array(
'host' => 'localhost',
'port' => 3306,
'charset' => 'utf8mb4',
),
'debug' => false,
));// Get a value
$host = $config->database->host;// Set a value
$config->database->host = 'xxxxxxxxxxxxx.xxxxxxxxxxxxx.us-west-2.rds.amazonaws.com';$override = new Kunfig\Config(array(
'database' => array(
'name' => 'test',
'user' => 'root',
'password' => null,
),
));/**
* @desc You can mix two Kunfig\ConfigInterface; the latter one
* will override values in the original one.
*/
$config->mix($override);$pdo = new PDO(
"mysql:host={$config->database->host}:{$config->database->port};dbname={$config->database->name}",
$config->database->user,
$config->database->password
);
```License
-------
See [LICENSE.md][license-url] file.[build-status-image]: https://img.shields.io/travis/vaibhavpandeyvpz/kunfig.svg?style=flat-square
[build-status-url]: https://travis-ci.org/vaibhavpandeyvpz/kunfig
[code-coverage-image]: https://img.shields.io/codecov/c/github/vaibhavpandeyvpz/kunfig.svg?style=flat-square
[code-coverage-url]: https://codecov.io/gh/vaibhavpandeyvpz/kunfig
[latest-version-image]: https://img.shields.io/github/release/vaibhavpandeyvpz/kunfig.svg?style=flat-square
[latest-version-url]: https://github.com/vaibhavpandeyvpz/kunfig/releases
[downloads-image]: https://img.shields.io/packagist/dt/vaibhavpandeyvpz/kunfig.svg?style=flat-square
[downloads-url]: https://packagist.org/packages/vaibhavpandeyvpz/kunfig
[php-version-image]: http://img.shields.io/badge/php-5.3+-8892be.svg?style=flat-square
[php-version-url]: https://packagist.org/packages/vaibhavpandeyvpz/kunfig
[license-image]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[license-url]: LICENSE.md
[insights-image]: https://insight.sensiolabs.com/projects/2606a5ca-43c2-4db9-ba3f-007e13e31362/small.png
[insights-url]: https://insight.sensiolabs.com/projects/2606a5ca-43c2-4db9-ba3f-007e13e31362