PHP code example of dez-php / dez-configuration

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

    

dez-php / dez-configuration example snippets




ig     = new Dez\Config\Adapter\NativeArray('./app.php');

$config->get('app')->get('path')->get('static');
$config['app']['path']['base'];
$config->app->path->base;
$config->app['path']->get('static');

$appJson    = $config['app']->toJSON();
$pathArray  = $config->app['path']->toArray();



ig     = new Dez\Config\Adapter\NativeArray('./_config.php');
$configJson = new Dez\Config\Adapter\Json('./_config.json');



use Dez\Config\Config;
 = Config::factory('./_config.ini');
// from native php file
$config2    = Config::factory('./_config.php');
// from json file
$config3    = Config::factory('./_config.json');
// from native php array
$config4    = Config::factory([
    'app' => [
        'site'  => 'test.com',
        'path'  => [
            'static'    => '/assets',
            'base'      => '/'
        ]
    ]
]);



use Dez\Config\Config;
nfig\Adapter\NativeArray('./connection.php');
$configIni      = Config::factory('./app.ini');
$configJson     = new Dez\Config\Adapter\Json('./site-setting.json');

$globalConfig   = $config->merge($configIni)->merge($configJson);



ig         = new Dez\Config\Adapter\NativeArray('./connection.php');

$config->toArray();
$config->toJSON();
$config->toObject();