1. Go to this page and download the library: Download krak/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/ */
krak / config example snippets
$config = Krak\Config\store();
// add array data
$config->add('a', [
'from_array' => true,
'b' => ['c' => 1]
]);
$config->add('a', function() {
return ['from_closure' => true],
});
// You can add, php, ini, json, or yml files, but you must provide the full path
$config->add('a', __DIR__ . '/path/a.php');
// or you can use this helper for files
$config->addFiles(__DIR__ . '/path', [
'a.php',
]);
$config->addPhpFiles(__DIR__ . '/path', ['a']); // this is the exact same as above
return [
'from_php_file' => true
];
var_dump($config->get('a'));
// or retrieve nested items
$config->get('a.b.c');