PHP code example of tleckie / config

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

    

tleckie / config example snippets




use Tleckie\Config\Config;

$data = [
    'user' => [
        'name' => 'John',
        'age' => 38,
        'friend' => [
            'name' => 'Mario',
            'age' => 25,
            'friend' => [
                'name' => 'Pedro',
                'age' => 48,
            ]
        ]
    ],
    'size' => '800x900'
];
$config = new Config($data);

var_dump($config->get('user')->get('friend')->get('friend')->get('name'));
var_dump($config->user->friend->friend->name);

$config->merge(['name' => 'Pedro']);
$config->merge(new Config(['name' => 'Pedro']));