2017 © Pedro Peláez
 

library phalcon-config-loader-yaml

A symfony2 inspired Yaml config loader for Phalcon framework

image

wcoppens/phalcon-config-loader-yaml

A symfony2 inspired Yaml config loader for Phalcon framework

  • Friday, July 8, 2016
  • by wcoppens
  • Repository
  • 1 Watchers
  • 2 Stars
  • 39 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

YamlConfigLoader

A symfony2 inspired Yaml config loader for Phalcon framework, (*1)

What does it do?

This configuration loader is a extremely simple addon build on top of the ExtendedYaml class provided by PhalconIncubator. It loads always 3 Yaml configuration files having always the following naming convention:, (*2)

  • parameters.yml (your dynamic configuration variables)
  • config.yml (the main configuration for the application)
  • config_{environment}.yml (the configuration which overwrites or add certain configs for the specific environment)

Setup

Use composer to install this bundle, (*3)

composer require wcoppens/phalcon-config-loader-yaml

First create a config directory somewhere (i usually use app/config). Second create the a config.yml, parameters.yml and (possibly multiple) config_{environment}.yml files., (*4)

You can use the following examples as your config files:, (*5)

#config.yml

database:
    adapter: Postgresql
    host: !parameter database_host
    username: !parameter database_username
    password: !parameter database_password
    dbname: !parameter database_name
    port: !parameter database_port
    schema: !parameter database_schema

application:
    controllersDir: !approot app/controllers/

#parameters.yml

parameters:
    database_host: somehost.net
    database_username: demo
    database_password: your-db-password
    database_name: demo
    database_port: 5432
    database_schema: public
#config_prod.yml

environment: production

Now you can load your config files by creating a new ConfigLoader instance for example in your loader file., (*6)


$config = new Wcoppens\Phalcon\ConfigLoader('Your config dir path', 'Your app-root path', 'environment'); /* * Now you can access all config variables just as with the original config system provided by Phalcon. * * Here some examples on how to access the variables. */ echo $config->application->controllersDir; echo $config->parameters->database_name

The Versions

08/07 2016

2.1.x-dev

2.1.9999999.9999999-dev https://github.com/wcoppens/YamlConfigLoader

A symfony2 inspired Yaml config loader for Phalcon framework

  Sources   Download

MIT

The Requires

 

by Wesley Coppens

framework phalcon

21/01 2015

dev-master

9999999-dev https://github.com/wcoppens/YamlConfigLoader

A symfony2 inspired Yaml config loader for Phalcon framework

  Sources   Download

MIT

The Requires

 

by Wesley Coppens

framework phalcon