PHP code example of cbc / configuration

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

    

cbc / configuration example snippets


use CBC\Utility\Configuration;

$config = [
    'database' => [
        'username' => 'db_username',
        'password' => 'db_password'
    ]
];

$config['database.name'] = 'db_name';

$configuration = new Configuration($config);

var_dump($configuration->get('database.username'));
// outputs:
// string (11) 'db_username'

var_dump($configuration->get('database'));
// outputs:
// array(3) [
//      'username' => 'db_username',
//      'password' => 'db_password',
//      'name'     => 'db_name'
// ]