PHP code example of jimbojsb / configulator

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

    

jimbojsb / configulator example snippets


// assume here you've at some point lator = new Configulator\Manager;

$configulator = Configulator();

Configulator()->setOptions(['configItem1' => 'configValue1']);

// or

Configulator()->loadFile("/path/to/myconfig.yml", "production");

$value = Configulator()["configItem1"];

Configulator()->register('mongodb', function() {
    return new MongoClient;
});

$mongo = Configulator()->mongodb();

Configulator()->register('mailer', function($configulator) {
    $transport = Swift_SmtpTransport::newInstance($configulator["smtp_host"], $configulator["smtp_port"]);
    return Swif_Mailer::newInstance($transport);
}, false);

$mailer = Configulator()->mailer();


Configulator()->loadFile('/path/to/myconfig.yml', 'development', '/path/to/local_myconfig.yml');