Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/glynnforrest/speedy-config

No-fuss PHP configuration loader, processor and cache.
https://github.com/glynnforrest/speedy-config

Last synced: 29 days ago
JSON representation

No-fuss PHP configuration loader, processor and cache.

Awesome Lists containing this project

README

        

# Speedy Config

[![Build Status](https://travis-ci.org/glynnforrest/speedy-config.svg?branch=master)](https://travis-ci.org/glynnforrest/speedy-config)

Load configuration from a variety of sources, process and validate it,
then cache the result for speedy loading the next time.

## Install

```bash
composer require glynnforrest/speedy-config
```

## Usage

Create a config builder with the loaders and processors to use:

```php

use SpeedyConfig\ConfigBuilder;
use SpeedyConfig\Loader\YamlLoader;
use SpeedyConfig\Loader\PhpLoader;
use SpeedyConfig\Processor\ReferenceProcessor;

$builder = new ConfigBuilder([new YamlLoader(), new PhpLoader()], new ReferenceProcessor());
```

Add resources to load:

```php
$builder->addResource('config.php')
->addResource('config.yml');
```

Then get the resolved configuration.

```php
$config = $builder->getConfig();

// instance of SpeedyConfig\Config
```