Download the PHP package markstory/cakephp-feature-flags without Composer
On this page you can find all versions of the php package markstory/cakephp-feature-flags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download markstory/cakephp-feature-flags
More information about markstory/cakephp-feature-flags
Files in markstory/cakephp-feature-flags
Package cakephp-feature-flags
Short Description Feature flags plugin for CakePHP
License MIT
Informations about the package cakephp-feature-flags
FeatureFlags plugin for CakePHP
FeatureFlags is a CakePHP plugin that enables your to use feature flags in your application to enable functionality based on simple application config, or a more complex rule based system.
By using feature flags you can separate your code deployments from what features are enabled, or have different features enabled in different environments. For example, you could have features that are incomplete, enabled in staging environments but disabled in production.
Installation
You can install this plugin into your application using composer.
The recommended way to install composer packages is:
Next, load the plugin by running the following command:
Usage
First you need to decide if you want simple boolean feature flags, or more complex
rule based feature flags. For the examples below, we'll assume you have two
features (calendar-v2
, and checkout-v2
) that you want to conditionally enable.
Simple Feature Flags
First create a configuration file config/features.php
, with the following:
In your Application::services()
method add the following:
With the DI container setup, you can have CakePHP inject the FeatureManager
into your controllers, and commands as required.
Rule Based Feature Flags
First create a configuration file config/features.php
, with the following:
In your Application::services()
method add the following:
With the DI container setup, you can have CakePHP inject the FeatureManager
into your controllers, and commands as required.
Writing conditions
Conditions will safely extract keys out of the context
that your application prepares.
Each condition compares a single attribute in your context
to a known value.
The following op
values are supported:
equal
Match if the context value matchesvalue
not_equal
Match if the context value is not equal tovalue
in
Match if the context value is within the array ofvalue
.not_in
Match if the context value is not contained in the array ofvalue
.