What is Feature Flags?

Feature flags provide the ability to restrict features to certain environments, while still using the same code base on all servers.

Administration

The main administration page is located at admin/config/development/featureflags, and lists all the current feature flags in the system. A new feature flag can be created by loading admin/config/development/featureflags/add.

API

Create a feature flag as a config entity. The status of the flag (active/inactive) is stored in state. The config entity is used for defining flags, but not storing their state.

Example:


use Drupal\featureflags\Entity\FeatureFlag;
if (FeatureFlag::isActive('my_feature_flag')) {
 // Do something.
}
else {
 // Do something else.
}
Supporting organizations:
Drupal 9 version

Project information

Releases

2.0.4 Stable release covered by the Drupal Security Team released 8 August 2024
Works with Drupal: ^8.8 || ~9.0 || ^10 || ^11

The one with D11 support peeps 1️⃣1️⃣🚀 (for real this time 😉)

Install:

Development version: 2.x-dev updated 8 Aug 2024 at 00:11 UTC