Download the PHP package ecn/featuretoggle-bundle without Composer

On this page you can find all versions of the php package ecn/featuretoggle-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 featuretoggle-bundle

ECNFeatureToggleBundle

Build Status SensioLabsInsight

This bundle adds feature toggle functionality to your Symfony project.

Requirements

In order to install ECNFeatureToggleBundle, you need at least

Installation

Step 1: Install via composer

Functionality of twig is only optional. Require it to your composer if you need it to use it.

Step 2: Activate the bundle

Add the bundle to the AppKernel.php:

Configuration

The idea behind Feature Toggle development is that features are defined on a local basis. Because of this it is a good idea to have your feature definitions in a separate config file, which shouldn't be under version control:

Create a new yml file, e.g. features.yml and make your SCM ignore this file.

Then add the following configuration to your features.yml:

Import the features.yml file into your configuration:

Usage

Step 1: Add a feature toggle

Define a new feature toggle inside your feature configuration:

Step 2: Check for a feature toggle inside the code

Now you can check inside your code, if this feature is defined.

Inside a twig template:

Or using the tag:

Inside an action:

Voters

In order to decide if a feature is available or not, voters are being used. Currently, there are five voters included.

AlwaysTrueVoter

This is the default voter, and it will always pass. So if you have a feature defined, it will always be displayed.

The full configuration for using this voter looks like this:

Because this is the default voter, the voter part in the configuration can be omitted.

AlwaysFalseVoter

This voter will always fail. If you have a feature defined that uses this voter, it will never be displayed.

The full configuration for using this voter looks like this:

RatioVoter

This voter passes on a given ratio between 0 and 1, which makes it suitable for A/B testing. The default ratio is 0.5.

The higher the ratio, the more likely the voter will pass. A value of 1 will make it pass every time, 0 will make it never pass.

Additionally, the result of the first check can be bound to the users' session. This is useful if you need a feature to be persistent across multiple requests. To enable this, just set sticky to true.

If you want to use this voter, this is the full configuration:

ScheduleVoter

This voter passes on a given schedule being after now.

If you want to use this voter, this is the full configuration:

RequestHeaderVoter

The name of the request header itself is by design case-insensitive.

Request header values are always treated as strings, so equal (==) checks are used and not identical matching (===).

Request header keys are by design case-insensitive.

The Voter does not pass if the request stack contains no current requests.

a. Specify key/value pairs

This voter passes, when all of the specified headers and their corresponding values are found and equal to that of the current request headers.

Example for key/value config:

b. specify request header keys only

You can also specify a list of request header keys without values.

In this case, only the existence of all of the specified request headers is checked.

All request header names are by the standard case-insensitive.

Example:

Mixing the two configurations is discouraged as it will lead to unexpected results by treating the config as key/value pairs, and will most likely cause the Voter to not pass.

Overriding the default voter

You can override the default voter like this:

Adding your own voters

Adding voters is straight forward. First make sure, that your voter implements \Ecn\FeatureToggleBundle\Voters\VoterInterface.

Then define your voter as service, tag it as ecn_featuretoggle.voter and give it an alias:

Testing

License

The MIT License (MIT). Please see License File for more information.


All versions of featuretoggle-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~8.0 | ~8.1
symfony/framework-bundle Version ^5.4 | ^6.0
doctrine/common Version 3.2.1
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 ecn/featuretoggle-bundle contains the following files

Loading the files please wait ....