2017 © Pedro Peláez
 

library phalcon-config-loader

Component to load configuration from various files

image

getsky/phalcon-config-loader

Component to load configuration from various files

  • Thursday, February 12, 2015
  • by JimmDiGrizli
  • Repository
  • 1 Watchers
  • 4 Stars
  • 431 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

ConfigLoader Build Status Dependency Status

ConfigLoader - it's manager configuration files for Phalcon. It allows you to create a configuration of various formats (ini, yaml, JSON, or any other, for which you will add adapter) via a single method., (*1)

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

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

ConfigLoader is able to track %environment% in configuration files and replace it on our environment., (*2)

// 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 

To add your adapter, you must call add () with transfer expansion and adapter class, which must inherit a class Phalcon\Config:, (*3)

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

Moreover, you can merge configuration files:, (*4)

#config.ini
[test]
test = true
%res% = import.ini
exp = %res:import.ini
%class% = Test/Class::SERVICES
import-class =  %class:Test/Class::SERVICES

#import.ini
import = "test"
namespace Test;

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

The result loading configuration from config.ini:, (*5)

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

Declared variables in the parent file will not be replaced by variables from the child (only %res% or %class%):, (*6)

# /app/config/config.ini
%res% = include.ini
[foo]
test = config-test
# /app/config/include.ini
[foo]
test = test
bar = bar
# result
[foo]
test = config-test
bar = bar

If you do not want to import resources (loading of the other configuration files in this configuration), the second parameter must pass a boolean false:, (*7)

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

The Versions

12/02 2015

dev-develop

dev-develop

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

31/10 2014

dev-master

9999999-dev

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

31/10 2014

v1.1.3

1.1.3.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

31/10 2014

v1.1.2

1.1.2.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

27/10 2014

v1.1.1

1.1.1.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

07/10 2014

v1.1.0

1.1.0.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

02/10 2014

v1.0.2

1.0.2.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

08/05 2014

v1.0.1

1.0.1.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon

07/05 2014

v1.0.0

1.0.0.0

Component to load configuration from various files

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar JimmDiGrizli

framework config phalcon