PHP code example of brofist / configuration

1. Go to this page and download the library: Download brofist/configuration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brofist / configuration example snippets




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',
    ],
];