PHP code example of mezon / conf
1. Go to this page and download the library: Download mezon/conf 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/ */
mezon / conf example snippets
$value = Conf::getValue('res/images/favicon', 'http://yoursite.com/res/images/favicon.ico');
Conf::setConfigValue('res/value', 'Value!');
var_dump(Conf::getValue('res/value')); // displays 'Value!' string
Conf::addConfigValue('res/value', 'Value 1!');
Conf::addConfigValue('res/value', 'Value 2!');
var_dump(Conf::getValue('res/value')); // displays array( [0] => 'Value 1!' , [1] => 'Value 2!' )
Conf::getValueAsArray(...);
Conf::getValueAsObject(...);
Conf::getValueAsString(...);
Conf::setConfigArrayValue(...);
Conf::setConfigObjectValue(...);
Conf::setConfigStringValue(...);
// here $settings is an associative array
Conf::setConfigValues(array $settings);
Conf::loadConfigFromJson(string $pathToConfig);
Conf::setConfigValue('res/value', 'Value!');
var_dump(Conf::configKeyExists('res')); // true
var_dump(Conf::configKeyExists('res2')); // false
var_dump(Conf::configKeyExists('res/value')); // true
Conf::setConfigValue('res/value', 'Value!');
Conf::deleteConfigValue('res/value');
var_dump(Conf::configKeyExists('res/value')); // false
var_dump(Conf::configKeyExists('res')); // also false
Conf::clear();