1. Go to this page and download the library: Download masnathan/config4all 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/ */
masnathan / config4all example snippets
//To get a value, you just need to know the path to get there
//if you want to know my name, just use the get method and pass the configuration file name
//and the keys to get my name, like this
echo $config->get('config', 'me', 'name');
//here are some other examples
echo $config->get('config', 'github');
echo $config->get('database', 'host');
//if the value that you are trying to get doesn't exist, you'll get a null
//you can also get the entire structure by calling the method get with no arguments
var_dump($config->get());
//You can also set new configs on the fly, or change existing ones
$config
->set('a', 'b', 'c', 'value')
->set('config', 'me', 'name', 'Not Andre Filipe')
->set('database', 'host', 'first', 'localhost')
->set('database', 'host', 'second', 'somehost')
->set('this is a null field');
//This will return 'value'
echo $config->set('a', 'b', 'c');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.