brofist/configuration

Handles merging of configurations

v0.1 2016-11-04 12:59 UTC

This package is not auto-updated.

Last update: 2024-11-09 21:01:34 UTC


README

Handles merging of configurations

Code information:

Build Status Coverage Status Code Coverage Scrutinizer Code Climate Issue Count Scrutinizer Code Quality StyleCI

Package information:

Latest Stable Version Total Downloads Latest Unstable Version License Dependency Status composer.lock

Usage

<?php

use Brofist\Configuration\Configuration;

$development = new Configuration([
    'env'   => 'development',
    'admin' => [
        'name'       => 'John',
        'middleName' => 'Some Middle Name',
    ],
]);

$production = new Configuration([
    'env'   => 'production',
    'admin' => [
        'name'     => 'Other Name',
        'lastName' => 'John',
    ],
]);

$application = $development->merge($production);

$application->toArray();

// will return

[
    // replaces when it is not an array
    'env'   => 'production',

    // merges when it is an array, replacing when necessary
    'admin' => [
        'name'       => 'Other Name',
        'middleName' => 'Some Middle Name',
        'lastName'   => 'John',
    ],
];

Installing

composer require brofist/configuration

Issues/Features proposals

Here is the issue tracker.

Lincense

MIT

Authors