Download the PHP package novaway/feature-flag-bundle without Composer
On this page you can find all versions of the php package novaway/feature-flag-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package feature-flag-bundle
FeatureFlagBundle
The FeatureFlagBundle is a bundle to manage features flags in your Symfony applications.
Compatibility
This bundle is tested with at least all maintained Symfony version.
Documentation
Install it
Install extension using composer:
If you don't use Flex, enable the bundle in your config/bundles.php file:
Configuration
To configure and register a feature manager you need a factory service. You may also need to change some options to the factory.
The factories that come with this bundle can be found in the table below.
| Factory service id | Options |
|---|---|
| novaway_feature_flag.factory.array | features |
Example configuration
You can declare multiple managers. Multiple providers is useful if you want to use different storage providers or to isolate your features flags.
When several managers are defined, they are registered in the Symfony dependency injection container as services with the following naming convention: novaway_feature_flag.manager.<manager_name>.
For example, the manager_bar is accessible with the following service name: novaway_feature_flag.manager.manager_bar.
Manager storage are also registered in the Symfony dependency injection container as services with the following naming convention: novaway_feature_flag.storage.<manager_name>.
Use it as a service
The bundle adds a global novaway_feature_flag.manager (also bind to FeatureManager) service you can use in your PHP classes.
In the case you have defined several managers, the service use the ChainedFeatureManager class to chain all declared managers.
In your Twig templates
You can also check a flag in your templates:
In the routing configuration
The package allows you to restrict a controller access by adding some configuration in your routing definition.
As a controller attribute
You can also restrict a controller access with attributes, two attributes are available:
Novaway\Bundle\FeatureFlagBundle\Attribute\FeatureEnabledNovaway\Bundle\FeatureFlagBundle\Attribute\FeatureDisabled
API Controller
The bundle provides an API controller that exposes feature flags via REST endpoints:
GET /features- Get all feature flags
To enable the API controller, you need to register its routes in your routing configuration:
You can also register endpoints manually:
The API returns JSON responses with feature flag data including key, description, and enabled status.
Implement your own storage provider
- First your need to create your storage provider class which implement the
Novaway\Bundle\FeatureFlagBundle\Storage\StorageInterfaceinterface - Register it in the Symfony dependency injection container
- Specify the storage you want to use in a manager configuration
When you create a storage, the static method create is called to create the storage instance.
License
This library is published under MIT license
All versions of feature-flag-bundle with dependencies
ext-json Version *
symfony/console Version ^5.4|^6.0|^7.0
symfony/framework-bundle Version ^5.4|^6.0|^7.0
symfony/options-resolver Version ^5.4|^6.0|^7.0