PHP code example of utopia-php / config

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

    

utopia-php / config example snippets




topia\Config\Config;

// Basic params
Config::setParam('key', 'value');
Config::getParam('key'); // Value
Config::getParam('keyx', 'default'); // default

// Nested params
Config::setParam('key3', ['key4' => 'value4']);
Config::getParam('key3'); // ['key4' => 'value4']
Config::getParam('key3.key4'); // value4

// Load config file (plain array)
Config::load('key5', __DIR__.'/demo.php');
Config::getParam('key5.key1', 'default'); // value1