2017 © Pedro PelĂĄez
 

symfony-bundle config-bundle

Bunde that offers some improvements in the configuration management of your Symfony application

image

aaronadal/config-bundle

Bunde that offers some improvements in the configuration management of your Symfony application

  • Saturday, April 1, 2017
  • by aaronadal
  • Repository
  • 0 Watchers
  • 0 Stars
  • 421 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 26 % Grown

The README.md

Config bundle

This bundle offers some improvements in the configuration management of your Symfony application., (*1)

It allows you to write your application configuration to multiple environment-dependant files that will be loaded automatically when the application starts., (*2)

What benefits does this bundle offer?

  • It offers an important DX: you can organize your configuration into several files without having to include them manually in your main config file., (*3)

  • It allows you to benefit from Symfony environments in a powerful way, and write different configurations for each of them easily., (*4)

  • It also provides a way to first determine a default set of services and parameters and then override them depending on the environment., (*5)

  • It takes advantage of the Symfony cache system, so it does not affect the loading time of your application., (*6)

Getting started

Install

You can use Composer to install this bundle:, (*7)

composer require aaronadal/config-bundle

After this, you need to register the bundle in your application kernel:, (*8)

// app/AppKernel.php

public function registerBundles()
{
    return [
        // ...
        new Aaronadal\ConfigBundle\AaronadalConfigBundle(),
        // ...
    ];
}

NOTE: Do not forget to place it above the bundles that depend on the dynamically loaded parameters., (*9)

Configure

You can configure two locations (through glob patterns) in which the bundle will look for the configuration files:, (*10)

  • Defaults: determines the path where default configuration files reside.
  • Environment: determines the path where environment-dependant configuration files reside. As you can see in the following example, there is an :env placeholder that references the environment at runtime (default: dev or prod).

Let's configure it in the config.yml:, (*11)

aaronadal_config:
    location:
        defaults:    config/parameters/defaults/*.yml
        environment: config/parameters/:env/*.yml

That's all! Quite simple. Now, all yml files inside the config/parameters/defaults/ folder will always be loaded and if the environment is, for example, dev, all the yml files inside the config/parameters/dev/ folder will override the default values (or will define new ones if not defined)., (*12)

NOTE 1: Due to the way in which parameters are resolved by Symfony, parameters cannot be used in the definition of the locations. Only the :env placeholder is valid., (*13)

NOTE 2: The locations may be absolute or relative paths. If they are relative paths, the kernel.root_dir is taken as the reference path., (*14)

Creating your own environments

Don't you know how to create new environments in Symfony?, (*15)

The Versions

01/04 2017

dev-master

9999999-dev

Bunde that offers some improvements in the configuration management of your Symfony application

  Sources   Download

MIT

The Requires

 

The Development Requires

by AarĂłn Nadal

01/04 2017

v1.1

1.1.0.0

Bunde that offers some improvements in the configuration management of your Symfony application

  Sources   Download

MIT

The Requires

 

The Development Requires

by AarĂłn Nadal

01/04 2017

v1.0

1.0.0.0

Bunde that offers some improvements in the configuration management of your Symfony application

  Sources   Download

MIT

The Requires

 

The Development Requires

by AarĂłn Nadal