PHP code example of webiny / config

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

    

webiny / config example snippets


    $config = \Webiny\Components\Config\Config::getInstance()->ini('path/to/file.ini');

    $config->properties->a = 'value';
    $config->properties->b->name = 'name';
    $config->properties->b->value = 'value';

    $config = \Webiny\Components\Config\Config::getInstance()->ini('path/to/file.ini', false, '_');

    $string = $config->getAsJson();
    $string = $config->getAsPhp();
    $string = $config->getAsIni($useSections = true, $nestDelimiter = '.');
    $string = $config->getAsYaml($indent = 4);

    $driverInstance = new MyCustomDriver();
    $string = $config->getAs($driverInstance);

$config->mergeWith($config2);