Download the PHP package adrenalinkin/config-helper without Composer
On this page you can find all versions of the php package adrenalinkin/config-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adrenalinkin/config-helper
More information about adrenalinkin/config-helper
Files in adrenalinkin/config-helper
Package config-helper
Short Description Extends Symfony Dependency Injection Component and provides store configurations in each bundles separately by common yaml-file
License MIT
Informations about the package config-helper
Config Helper
Introduction
Component allows extend standard class Symfony\Component\DependencyInjection\Extension\Extension and open possibility
for collect YAML configurations across all registered bundles.
Installation
Open a command console, enter your project directory and execute the following command to download the latest stable version of this component:
This command requires you to have Composer install globally.
Usage examples and compare with standard methods
Let's say we have two bundles in our project. Bundles contains business-logic of the two separate system parts:
AcmeBundlewith entitiesAcmeBundle:UserandAcmeBundle:PositionAcmePostBundlewith entityAcmePostBundle:Post
Imagine you need to add configuration for each entity. Let's say we need configuration which should determine
user's system role for get access to specific functionality. For the configuration creation has been created bundle
AcmeConfigBundle. Configuration example:
Standard methods
We can put configuration into global configuration file app/config/config.yml:
Also, we can put configuration into AcmeConfigBundle bundle under specific configuration file and load that from
AcmeConfigExtension:
However, both of method, for our realisation, got one flaw. All time when we will create new bundles - we will need
modify global configuration file or configuration file in the AcmeConfigBundle.
Both situation provoke a hard-linking between separate parts of the project
Component usage
To prevent hard-linkin between separate parts of the project you need:
- Choose file name for configuration store, for example
acme_config.yml. -
Extends
AcmeConfigExtensionfrom AbstractExtension: - Create configuration files per bundles:
This method allows you create and remove configurations in the bundles without global changes in the project. You can
remove some configuration in the needed bundle or even remove whole bundle ( for example AcmePostBundle).
Note: By default method getConfigurationsFromFile($fileName, ContainerBuilder $container, $merge = true) uses
standard PHP function array_merge_recursive to merge
all found configurations. If you want prepare configuration by yourself put false as third parameter and receive
stack of the all registered configurations.
License
All versions of config-helper with dependencies
symfony/config Version ~2.5||~3.0||~4.0
symfony/dependency-injection Version ~2.5||~3.0||~4.0
symfony/finder Version ~2.5||~3.0||~4.0
symfony/yaml Version ~2.3.42||~2.7.14||~2.8.7||~3.0||~4.0