PHP code example of xervice / config

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

    

xervice / config example snippets


$config[\Xervice\Config\XerviceConfig::ADDITIONAL_CONFIG_FILES] = [
    __DIR__ . '/addition_config.php'
];

$configProvider = new XerviceConfig(new XerviceConfigFactory());
$config = $configProvider->getConfig();

$value = $config->get('CONFIG_KEY');

$valueWithDefault = $config->get('CONFIG_KEY', 'defaultvalue');


// Or with the static method way
$configProvider = XerviceConfig::getInstance();
$config = $configProvider->getConfig();

...

// Or direct static access
XerviceConfig::set('key', 'value');
XerviceConfig::get('key'); // value