brofist/configuration

Handles merging of configurations

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

This package is not auto-updated.

Last update: 2024-03-16 17:22:06 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