PHP code example of elzekool / configuration_reader
1. Go to this page and download the library: Download elzekool/configuration_reader 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/ */
elzekool / configuration_reader example snippets
use ElzeKool\ConfigurationReader\ConfigurationReader;
$config = new ConfigurationReader(array(
'configuration/config.ini',
// [group]
// option1="value"
// option2="value2"
// option3[]="value3"
// option3[]="value4"
'configuration/test/config.ini',
// Does not exist
'configuration/development/config.ini'
// [group]
// option1="altvalue1"
// option3[]="altvalue3"
// option3[]="altvalue4"
// option5="development"
));
var_dump($config->get('group.option1'));
// string(9) "altvalue1"
var_dump($config->get('group.doesnotexists', 'nope'));
// string(4) "nope"
print_r($config->get('group'));
// Array
// (
// [option1] => altvalue1
// [option2] => value2
// [option3] => Array
// (
// [0] => altvalue3
// [1] => altvalue4
// )
//
// [option5] => development
// )