PHP code example of allmarkedup / conph
1. Go to this page and download the library: Download allmarkedup/conph 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/ */
allmarkedup / conph example snippets
class MyConfig extends Amu\Conph\Config
{
public function convertPaths($value)
{
return array_map(function($item){
return '/my/base/path' . $item;
}, $value);
}
}
$config = new MyConfig([
"paths" => [
"templates" => "the_template_path",
"config" => "the_config_path"
],
"settings" => [
"debug" => true
],
'names' => [
"batman" => 'Fred',
"superman" => 'Dave'
]
]);
// Nested values - dot notation
$debug = $config->get('settings.debug');
$config->set('names.batman', 'Clive');
// Custom converter functions
$config->get('paths.templates'); // => /my/base/path/the_template_path