PHP code example of simplecomplex / config

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

    

simplecomplex / config example snippets


// Bootstrap.
Dependency::genericSetMultiple([
    'cache-broker' => function () {
        return new \SimpleComplex\Cache\CacheBroker();
    },
    'config' => function() {
        return new \SimpleComplex\Config\Config('global');
    },
]);
// ...
// Use.
/** @var \Psr\Container\ContainerInterface $container */
$container = Dependency::container();
/**
 * Create or re-initialize the 'global' config store;
 * based on ini-files placed in base and override paths,
 * cached by a PSR-16 Simple Cache cache store.
 *
 * @var \SimpleComplex\Config\IniSectionedConfig $config
 */
$config = $container->get('config');
/** @var mixed $whatever */
$whatever = $config->get('some-section', 'some-key', 'the default value');
 $value = $config->get('key') 
 $value = $config->get('section', 'key') 
global.ini
conf/ini/base/
some-ding.global.ini