All Projects → Incenteev → DynamicParametersBundle

Incenteev / DynamicParametersBundle

Licence: MIT license
[UNMAINTAINED] Runtime retrieval of parameters from environment variables for Symfony

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to DynamicParametersBundle

jsonrpc-bundle
JSON-RPC server for Symfony: exposes services registered in the service container as JSON-RPC-webservices
Stars: ✭ 31 (-26.19%)
Mutual labels:  bundle, symfony-bundle
LiipSoapRecorderBundle
[DEPRECATED] Recorder/Player for SOAP communications
Stars: ✭ 12 (-71.43%)
Mutual labels:  bundle, symfony-bundle
hashed-asset-bundle
Apply an asset version based on a hash of the asset for symfony/asset
Stars: ✭ 24 (-42.86%)
Mutual labels:  bundle, symfony-bundle
FkrCssURLRewriteBundle
A small assetic filter for symfony to fix all url paths at css documents to correct urls
Stars: ✭ 33 (-21.43%)
Mutual labels:  bundle, symfony-bundle
SonataFormatterBundle
Symfony SonataFormatterBundle
Stars: ✭ 78 (+85.71%)
Mutual labels:  bundle, symfony-bundle
SonataDoctrineMongoDBAdminBundle
Symfony Sonata / Integrate Doctrine MongoDB ODM into the SonataAdminBundle
Stars: ✭ 64 (+52.38%)
Mutual labels:  bundle, symfony-bundle
NucleosDompdfBundle
📜 This bundle provides a wrapper for using dompdf inside symfony.
Stars: ✭ 29 (-30.95%)
Mutual labels:  bundle, symfony-bundle
LiipSearchBundle
[DEPRECATED] Google XML API for searching is discontinued
Stars: ✭ 35 (-16.67%)
Mutual labels:  bundle, symfony-bundle
BeelabTagBundle
🏷 A simple implementation of tags for Symfony and Doctrine ORM
Stars: ✭ 45 (+7.14%)
Mutual labels:  bundle, symfony-bundle
awsBundle
Symfony AWS Bundle (supports Symfony 2, 3 and 4)
Stars: ✭ 18 (-57.14%)
Mutual labels:  bundle, symfony-bundle
stampie-bundle
stampie.github.io/
Stars: ✭ 26 (-38.1%)
Mutual labels:  bundle, symfony-bundle
OpcacheBundle
Displays the PHP OPcache status in the Symfony profiler toolbar.
Stars: ✭ 21 (-50%)
Mutual labels:  bundle, symfony-bundle
SonataDashboardBundle
[Abandoned] Provides a Dashboard management through container and block services
Stars: ✭ 17 (-59.52%)
Mutual labels:  bundle, symfony-bundle
LiipImagineSerializationBundle
Provides integration between LiipImagineBundle and JMSSerializerBundle
Stars: ✭ 24 (-42.86%)
Mutual labels:  bundle, symfony-bundle
SlackBundle
SlackBundle for Symfony2 with Guzzle-Integration
Stars: ✭ 39 (-7.14%)
Mutual labels:  bundle, symfony-bundle
connect-bundle
No description or website provided.
Stars: ✭ 35 (-16.67%)
Mutual labels:  bundle, symfony-bundle
SonataTimelineBundle
[Abandoned] Integrates SpyTimelineBundle into Sonata
Stars: ✭ 24 (-42.86%)
Mutual labels:  bundle, symfony-bundle
SensioBuzzBundle
No description or website provided.
Stars: ✭ 89 (+111.9%)
Mutual labels:  bundle, symfony-bundle
breadcrumb-bundle
Symfony bundle for easy breadcrumbs management
Stars: ✭ 26 (-38.1%)
Mutual labels:  bundle, symfony-bundle
socketio
No description or website provided.
Stars: ✭ 23 (-45.24%)
Mutual labels:  bundle, symfony-bundle

DynamicParametersBundle

This bundle provides a way to read parameters from environment variables at runtime. The value defined in the container parameter is used as fallback when the environment variable is not available.

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Latest Stable Version Latest Unstable Version License

Installation

Installation is a quick (I promise!) 2 step process:

  1. Download IncenteevDynamicParametersBundle
  2. Enable the bundle

Step 1: Install IncenteevDynamicParametersBundle with composer

Run the following composer require command:

$ composer require incenteev/dynamic-parameters-bundle

Step 2: Enable the bundle

Finally, enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Incenteev\DynamicParametersBundle\IncenteevDynamicParametersBundle(),
    );
}

Usage

Define the map of parameter names with the environment variable used to configure them.

# app/config/config.yml
incenteev_dynamic_parameters:
    parameters:
        database_host: DATABASE_HOST
        "database.name": DATABASE_NAME

Environment variables are always strings. To be able to set parameters of other types, the bundle supports parsing the environment variable as inline Yaml:

# app/config/config.yml
incenteev_dynamic_parameters:
    parameters:
        use_ssl:
            variable: HAS_SSL
            yaml: true

ParameterHandler integration

If you are using the env-map feature of the Incenteev ParameterHandler, you can import the whole env-map very easily:

# app/config/config.yml
incenteev_dynamic_parameters:
    import_parameter_handler_map: true
    parameters:
        something_else: NOT_IN_THE_COMPOSER_JSON

The ParameterHandler parses the environment variables as inline Yaml, so the Yaml parsing is automatically enabled for these variables when importing the map.

Note: Any parameter defined explicitly will win over the imported map.

By default, the bundle will look for the composer.json file in %kernel.root_dir%/../composer.json. If you use a non-standard location for your kernel, you can change the path to your composer.json file to read the env-map:

# app/config/config.yml
incenteev_dynamic_parameters:
    import_parameter_handler_map: true
    composer_file: path/to/composer.json

Retrieving parameters at runtime

The bundle takes care of service arguments, but changing the behavior of $container->getParameter() is not possible. However, it exposes a service to get parameters taking the environment variables into account.

$this->get('incenteev_dynamic_parameters.retriever')->get('use_ssl');

Limitations

  • Getting a parameter from the container directly at runtime will not use the environment variable
  • Parameters or arguments built by concatenating other parameters together will not rely on the environment variables (yet)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].