PHP code example of popphp / pop-config

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

    

popphp / pop-config example snippets


use Pop\Config\Config;

$config = new Config(['foo' => 'bar']);

$foo = $config->foo;
// OR
$foo = $config['foo'];

use Pop\Config\Config;

$config = new Config(['foo' => 'bar'], true);
$config->foo = 'New Value';

use Pop\Config\Config;

$config = new Config($configData);
$config->merge($newData);

use Pop\Config\Config;

$config = new Config($configData);
$data   = $config->toArray();

use Pop\Config\Config;

$config = Config::createFromData('/path/to/config.ini');

// $value equals 1
$value = $config->foo->bar;

use Pop\Config\Config;

$config = new Config($configData);
echo $config->render('json');