1. Go to this page and download the library: Download pinepain/simple-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/ */
pinepain / simple-config example snippets
SimpleConfig\Loaders\FilesLoader;
use Pinepain\SimpleConfig\Config;
$loader = new FilesLoader(__DIR__ . '/config');
$config_items = $loader->load();
$config = new Config($config_items);
$config->has('some.value.you.are.looking.for');
$config->get('some.value'); // will return all nested values under 'some.value' section
$config->set('some.value', 'changed'); // change it
// get item value or use default value if original item missed (and it is as we change it above)
$config->get('some.value.you.are.looking.for', 'missed');
namespace Pinepain\SimpleConfig;
interface ConfigInterface
{
/**
* @param array | \ArrayObject $items
*/
public function __construct($items);
/**
* Get all of the configuration items.
*
* @return array
*/
public function all();
/**
* Determine if the given configuration value exists.
*
* @param string $key
* @return bool
*/
public function has($key);
/**
* Get the specified configuration value.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null);
/**
* Set a given configuration value.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function set($key, $value = null);
}