hotflo/feature-toggle-bundle

A Symfony2 Bundle implementing the https://github.com/JoshuaEstes/FeatureToggle library

This package's canonical repository appears to be gone and the package has been frozen as a result.

Installs: 4 096

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 1

Type:symfony-bundle

v0.1.1 2015-07-07 07:56 UTC

This package is not auto-updated.

Last update: 2022-04-02 04:57:37 UTC


README

A Symfony2 Bundle implementing the https://github.com/JoshuaEstes/FeatureToggle library

Install

Install with composer:

composer.phar require hotflo/feature-toggle-bundle

Add to your AppKernel.php

new Hotflo\FeatureToggleBundle\HotfloFeatureToggleBundle(),

Configuration

To use this bundle you should configure toggles and feature in the config.yml. You can use a class or a service as toggle and then use the configured toggles in your features.

Full reference:

hotflo_feature_toggle:
    toggles:
        generic:
            class: JoshuaEstes\Component\FeatureToggle\Toggle\FeatureToggleGeneric
            options:
                enabled: true
        generic_service:
            type: service
            service: hotflo_feature_toggle.generic_feature_toggle
    features:
        dashboard:
            toggle: generic_service

Usage

In your controller, the feature container is available in the Symfony2 service container.

Example:

$this->get('hotflo_feature_toggle.feature_container')->getFeature('dashboard');

The configured feature toggles are also available in the Symfony2 service container.

$this->get('hotflo_feature_toggle.feature_toggle_container')->getFeatureToggle('generic');

Test

Start the tests by running PHP Unit:

./bin/phpunit

More documentation

This bundle depends on the FeatureToggle library. The documentation of this library can be found here: http://feature-toggle.readthedocs.org/en/latest/