PHP code example of gap / config

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

    

gap / config example snippets




use Gap\Config\ConfigBuilder;

$settingDir = '/your/setting/dir';
$cacheFile = '/your/setting/cache-file';
$configBuilder = new ConfigBuilder(
    $settingDir,
    $cacheFile
);

$config = $configBuilder->build();

$debug = $config->bool('debug'); // false

$dbDefaultConfg = $config->config('db')->config('default');

$dbDefaultConfig->str('driver');
$dbDefaultConfig->str('database');
$dbDefaultConfig->str('host');
$dbDefaultConfig->str('username');

$dbDefaultConfig->arr('username');
/*
[
    'driver' => 'mysql',
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'database' => 'db',
    'host' => 'host',
    'username' => 'username',
    'password' => 'passwd'
]
*/