PHP code example of getsky / phalcon-config-loader

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

    

getsky / phalcon-config-loader example snippets


$configYml = $configLoader->create('config.yml');
$configIni = $configLoader->create('config.ini');
$configPhp = $configLoader->create('config.php');


// or use string
$string = 'foo = bar'
$configFromText = $configLoader->fromText($string, 'ini');

// or use arrays
$config = ['foo' => 'bar'];
$configFromArray = $configLoader->fromArray($config);

// Create ConfigLoader and specify the environment of our application
$configLoader = new ConfigLoader('prod');

// config.yml : test: %environment%
$configYml = $configLoader->create('config.yml');

echo $configYml->test;
// print: prod 

$config = $configLoader->add('xml', 'MyNamespace/XmlConfig');

namespace Test;

class Class {
  const SERVICES = '/const.ini';
}

[                               
    'test' => [                 
        'test' => true,                             
        'import' => true,       
        'env' => 'dev',
        'exp' => [
            'import' => true,
            'env' => 'dev'
        ],
        'class' => "class",
        'impot-class' => [
            'class' => "class"
        ]
    ]                           
]                               

$config = $configLoader->create('config.ini', false);