PHP code example of fobia / php-configuration

1. Go to this page and download the library: Download fobia/php-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/ */

    

fobia / php-configuration example snippets



use Fobia\Configuration\Configuration;

$config = new Configuration();
$config->setArray(array(
    'path1.to1' => 'value11',
    'path1.to2' => 'value12',
    'path2' => array(
        'to1' => 'value21'
    )
));


// Array (
//     [to1] => value11 
//     [to2] => value12
// )
print_r($config['path1']);  

echo $config['path1.to1'];    // 'value11'
echo $config['path1']['to2']; // 'value12'
echo $config['path2']['to1']; // 'value21'