PHP code example of eve-in-ua / multiconf

1. Go to this page and download the library: Download eve-in-ua/multiconf 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/ */

    

eve-in-ua / multiconf example snippets




return [
    'foo' => 'bar',
    'zoo' => [
        'baz', // 0 => 'baz'

    ],

];



return [
    'foo' => 'baz',
    'def' => 'def',
];


$multiConf = new \EveInUa\MultiConf\Config(); // version 1
$multiConf = new \MultiConf(); // version 2
$multiConf = \MultiConf::instance(); // version 3 - best

// Wait for `example2` to load:
if ($multiConf->waitFor('a-first-config', ['env', 'example2'])) { return null; }

return [
    'foo' => 'baz',
    'def' => 'def',
    'example2-data' => $multiConf->config('example2'),
];


// You can set directories manually for library using $_SERVER['DOCUMENT_ROOT'] as CONFIG_ROOT and ENV_ROOT 
define('CONFIG_ROOT', __DIR__); // optional, will use DOCUMENT_ROOT instead
define('ENV_ROOT', __DIR__); // optional, will use DOCUMENT_ROOT instead
OT/.env.default
    $multiConf->config('example.foo'),  // bar       - from CONFIG_ROOT/config/example.php
    $multiConf->config('example.def'),  // def       - from CONFIG_ROOT/config/example.default.php
];
var_dump($result);