PHP code example of wtframework / config

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

    

wtframework / config example snippets


use WTFramework\Config\Config;

Config::set(['key1' => 'value1']);

Config::set('key2', 'value2');

Config::set(['key1' => ['key2' => 'value2']]);

Config::set('key1.key3', 'value3');

Config::set(['key1' => 'value']);

// Returns 'value'
$key1 = Config::get('key1');

// Returns null
$key2 = Config::get('key2');

// Returns 0
$key3 = Config::get('key3', 0);

Config::set(['key1' => ['key2' => 'value']]);

// Returns 'value'
$key2 = Config::get('key1.key2');

use function WTFramework\Config\config;

$key = config('key', 'default');