Download the PHP package opensky/runtime-config-bundle without Composer

On this page you can find all versions of the php package opensky/runtime-config-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package runtime-config-bundle

RuntimeConfigBundle

This bundle provides a way to inject parameters into services at runtime by exposing a RuntimeParameterBag service, which functions exactly like Symfony2's own ParameterBags.

As-is, Symfony2's service container is compiled and cached to disk, which makes it difficult to inject dynamic parameters. By exposing a ParameterBag service, we can inject values returned from its get() method into other services.

One reason you might want support for dynamic parameters would be to implement feature flags/flippers, as are used by GitHub and Flickr. More info on the history behind this bundle may be found on the symfony-devs mailing list.

Installation

Step 1: Download OpenSkyRuntimeConfigBundle using composer:

Require the bundle with composer:

Step 2: Enable the bundle

Enable the bundle in the kernel:

Step 3: Configure your application's config.yml

The RuntimeParameterBag may be configured with the following:

These settings are explained below:

Note: when using cascade, it's a good idea to define default values for your runtime configuration parameters in your service container. This will help avoid an undesirable ParameterNotFoundException if you happen to fetch a parameter that is not yet defined in your runtime configuration.

Injecting Parameters

Consider the scenario where "my.service" depends on a dynamic parameter "my.service.enabled".

Runtime parameters may be conveniently injected using Symfony's expression language syntax:

XML is recommended for services defined within a bundle:

YAML is recommended for application-wide services:

Cascade Mode

If you have enabled cascade mode, get() will attempt to fetch undefined runtime parameters from the service container before throwing an exception.

Building upon the previous XML example, this would look like:

In this example, get('my.services.enabled') would return false even if the parameter was not defined in the runtime configuration. This is a safe way to introduce new parameters, which might not yet be available from your provider at the time of deployment.

Note: parameters sourced from the runtime configuration provider are not resolved for placeholder syntax (i.e. "%reference%"), unlike those defined in the service container.

Recipe: Interpreting Parameter Values as YAML

If you're using Doctrine ORM (or any database) to hold your parameters, you will likely implement a CRUD interface to define and edit parameters via an admin controller in your application.

Additionally, this allows us to add custom behavior to our ParameterProvider. For instance, we can use Symfony2's YAML component to interpret parameter values stored in the database as strings.

Consider the following Entity:

Several things are happening here:

The above Entity class is complemented by the following EntityRepository, which serves as the ParameterProvider for the RuntimeParameterBag:

The base ParameterRepository already fetches name/value pairs from the database via a DQL query. Using array_map(), we can easily interpret those values through the same YAML component method.

Note: although we validate the Entity, it's possible that a value might have been manually altered in the database and contain invalid YAML when parameters are fetched for provision. If this is a concern, you may want to gracefully handle thrown ParseExceptions within getParametersAsKeyValueHash().

Recipe: Interpreting Parameter Values as YAML

It is also possible to store the parameter values as JSON. In order to do this, we need to re-define the value parameter as type "json" instead of "string".

Consider the following Entity:

In this case, we would not need to override the default repository query, getParametersAsKeyValueHash(), as the database results have already been json_decoded by Doctrine.


All versions of runtime-config-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
doctrine/orm Version ^2.4
symfony/doctrine-bridge Version ^3.0|^4.0|^5.0
symfony/framework-bundle Version ^3.0|^4.0|^5.0
symfony/validator Version ^3.0|^4.0|^5.0
symfony/yaml Version ^3.0|^4.0|^5.0
twig/twig Version ^2.13|^3.0.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package opensky/runtime-config-bundle contains the following files

Loading the files please wait ....