/YamlConfig

Utilize symfony components (The Config Component, The Yaml Component) to provide symfony like configuration for any application.

Primary LanguagePHP

Build Status

Utilize symfony components (The Config Component and The Yaml Component) to provide symfony like configuration for any application.

Installation

composer require keiii/yaml-config

Config example

# /parameters.yml
parameters:
    db_username: 'root'
    db_password: 'secret'
# /config/config.env.yml
imports:
    - { resource: '../parameters.yml' }

database:
    username: '%db_username%'
    password: '%db_password%'

Usage

<?php

$loader = \KEIII\YamlConfig\Factory::create(
    __DIR__.'/config', // configs path
    ['key' => 'value'], // replacements
    __DIR__.'/var/cache' // cache path or false
);

$config = $loader->load('config.env.yml'); // array