PHP code example of lorenzoferrarajr / lfj-configuration-builder

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

    

lorenzoferrarajr / lfj-configuration-builder example snippets



// mail.global.php

return array(
    'mail' => array(
        'host' => 'localhost',
        'port' => 25
    )
);


// mail.local.php

return array(
    'mail' => array(
        'host' => '192.168.1.1',
    )
);


$cb = new \Lfj\ConfigurationBuilder\ConfigurationBuilder();

$cb->addFile(__DIR__.'/config/mail.global.php');
$cb->addFile(__DIR__.'/config/mail.local.php');

$config = $cb->build();

$cb = new \Lfj\ConfigurationBuilder\ConfigurationBuilder();

$cb->addFiles(array(
    __DIR__.'/config/mail.global.php',
    __DIR__.'/config/mail.local.php',
));

$config = $cb->build();

$cb = new \Lfj\ConfigurationBuilder\ConfigurationBuilder();

$cb->addDirectory(__DIR__.'/config/*.{global,local}.php');

$config = $cb->build();

$cb = new \Lfj\ConfigurationBuilder\ConfigurationBuilder();

$cb->addDirectory(__DIR__.'/config/*.{global,local}.php');
$cb->addArray(array(
    'mail' => array(
        'host' => 'other'
    )
));

$config = $cb->build();