PHP code example of ofcold / configuration

1. Go to this page and download the library: Download ofcold/configuration 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/ */

    

ofcold / configuration example snippets



use Ofcold\Configuration\LoaderConfiguration;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Config\Repository;

$loader = new LoaderConfiguration(
	$config = new Repository,
	new Filesystem
);

$loader->addNamespace('test', __DIR__ . '/tests/config');

print_r(json_encode($config->all()));
// print_r($config->get('test::test.foo') . "\r\n");

$loader->addNamespaceOverrides('test', __DIR__ . '/tests/overrides');

print_r(json_encode($config->all()));
// print_r($config->get('test::test.foo')  . "\r\n");



use Ofcold\Configuration\LoaderConfiguration;

class Foo
{
	/**
	 * Create an a new Foo instance.
	 *
	 * @param LoaderConfiguration $loader
	 */
	public function __construct(LoaderConfiguration $loader)
	{
		$loader->addNamespace('test', '/config');
	}
}
bash
    php test