Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lezhnev74/dummy-config-loader

Access configuration values from PHP arrays with dot syntax: `database.default.driver`
https://github.com/lezhnev74/dummy-config-loader

configuration php7

Last synced: 18 days ago
JSON representation

Access configuration values from PHP arrays with dot syntax: `database.default.driver`

Awesome Lists containing this project

README

        

[![Latest Stable Version](https://poser.pugx.org/lezhnev74/dummy-config-loader/v/stable)](https://packagist.org/packages/lezhnev74/dummy-config-loader)
[![Build Status](https://travis-ci.org/lezhnev74/dummy-config-loader.svg?branch=master)](https://travis-ci.org/lezhnev74/dummy-config-loader)
[![License](https://poser.pugx.org/lezhnev74/dummy-config-loader/license)](https://packagist.org/packages/lezhnev74/dummy-config-loader)
[![Total Downloads](https://poser.pugx.org/lezhnev74/dummy-config-loader/downloads)](https://packagist.org/packages/lezhnev74/dummy-config-loader)

# Usage

```php
$config = new DummyConfigLoader\Config(__DIR__); // this will look for config files in this folder
$value = $config->get('database.default.driver', 'mongodb');
```

You will get `mariadb` as `$value` if you will place file `database.php` in the given folder with contents:

```php
return [
"default" => [
"driver" => "mariadb"
]
];
```

Otherwise you will get `mongodb`.

First section of any key addresses the file within the directory. One level of recursion allowed. If no such file found in the folder - exception will be thrown.

## Installation

```
composer require lezhnev74/dummy-config-loader
```

## Support

If you need help - feel comfortable to ping me at [email protected]