PHPackages                             devexploris/shizuku-feature-flags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. devexploris/shizuku-feature-flags

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

devexploris/shizuku-feature-flags
=================================

Symfony bundle to manage feature flags backed by Doctrine ORM

1.0.0(3w ago)11↓100%MITPHPPHP &gt;=8.2

Since May 17Pushed 3w agoCompare

[ Source](https://github.com/DevExploris/Shizuku-Feature-Flags)[ Packagist](https://packagist.org/packages/devexploris/shizuku-feature-flags)[ RSS](/packages/devexploris-shizuku-feature-flags/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (10)Versions (1)Used By (0)

Shizuku Feature Flags
=====================

[](#shizuku-feature-flags)

A Symfony bundle for managing feature flags backed by Doctrine ORM.

**[Official (EN) documentation →](https://devexploris.com/shizuku?lang=en)****[Documentation officielle →](https://devexploris.com/shizuku)**

Requirements
------------

[](#requirements)

- PHP 8.2+
- Symfony 7.4+ or 8.0+
- Doctrine ORM 3.x

Installation
------------

[](#installation)

### 1. Require the bundle

[](#1-require-the-bundle)

```
composer require devexploris/shizuku-feature-flags
```

### 2. Register the bundle

[](#2-register-the-bundle)

```
// config/bundles.php
return [
    Devexploris\ShizukuFeatureFlags\ShizukuFeatureFlagsBundle::class => ['all' => true],
];
```

### 3. Create the database table

[](#3-create-the-database-table)

The bundle does not ship its own migrations. Generate and run a migration from your application:

```
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```

Usage
-----

[](#usage)

### Checking a flag in PHP

[](#checking-a-flag-in-php)

Inject `FeatureFlagService` and call `isEnabled()`:

```
use Devexploris\ShizukuFeatureFlags\Service\FeatureFlagService;

class MyService
{
    public function __construct(private FeatureFlagService $flags) {}

    public function doSomething(): void
    {
        if ($this->flags->isEnabled('my_feature')) {
            // new behaviour
        }
    }
}
```

An unknown flag (not found in the database) always returns `false`.

### Checking a flag in Twig

[](#checking-a-flag-in-twig)

The bundle registers a global `feature()` Twig function:

```
{% if feature('my_feature') %}
    {# new behaviour #}
{% endif %}

{# inline use #}

```

An unknown flag (not found in the database) always returns `false` — the template renders as if the flag were disabled, with no error thrown.

Console commands
----------------

[](#console-commands)

All flag names must follow the `snake_case` format: lowercase letters, digits and underscores, starting with a letter.

### List flags

[](#list-flags)

```
php bin/console shizuku:list [filter]
```

`filter` is optional. Accepted values: `All`, `Enabled`, `Disabled`, `Locked`. When omitted, an interactive prompt is shown.

### Create a flag

[](#create-a-flag)

```
php bin/console shizuku:flag:create
php bin/console shizuku:flag:create --name=my_feature --description="My feature" --enable
```

When called without options, an interactive prompt guides you through name, description and initial state.

### Enable a flag

[](#enable-a-flag)

```
php bin/console shizuku:flag:enable
php bin/console shizuku:flag:enable --name=my_feature
```

Locked flags cannot be enabled.

### Disable a flag

[](#disable-a-flag)

```
php bin/console shizuku:flag:disable
php bin/console shizuku:flag:disable --name=my_feature
```

Locked flags cannot be disabled.

### Lock a flag

[](#lock-a-flag)

```
php bin/console shizuku:flag:lock
php bin/console shizuku:flag:lock --name=my_feature
```

Locking a flag prevents any further enable or disable operations. It signals that the flag's state is final and the code paths it guards should be cleaned up before the flag is deleted.

### Delete a flag

[](#delete-a-flag)

```
php bin/console shizuku:flag:delete
php bin/console shizuku:flag:delete --name=my_feature
php bin/console shizuku:flag:delete --name=my_feature --force
```

By default, only locked flags can be deleted. Use `--force` to delete a non-locked flag, with confirmation.

Flag lifecycle
--------------

[](#flag-lifecycle)

```
created -> enabled / disabled -> locked -> deleted

```

1. A flag is created in a disabled state by default.
2. It can be toggled freely until it is locked.
3. Once locked, its state is frozen. The Symfony Profiler panel marks it as "Must be cleaned before removal", prompting you to remove the `isEnabled()` calls from the code.
4. Once the code is cleaned up, the flag can be deleted.

Caching
-------

[](#caching)

The bundle integrates with the Symfony Cache component to avoid a database query on every `isEnabled()` call.

When `cache.app` is available in the container (the default Symfony cache pool), the bundle wires it automatically — no configuration needed.

Flag state is cached for **300 seconds**. The cache entry for a flag is invalidated immediately whenever its state changes via a console command (`enable`, `disable`, `lock`, `delete`, `create`). Direct database edits bypass this invalidation and will be visible after the TTL expires.

To use a different cache pool, override the `$cache` argument on `FeatureFlagService` and the mutating commands in your `services.yaml`:

```
Devexploris\ShizukuFeatureFlags\Service\FeatureFlagService:
    arguments:
        $cache: '@cache.my_custom_pool'
```

To disable caching entirely, set the argument to `null`:

```
Devexploris\ShizukuFeatureFlags\Service\FeatureFlagService:
    arguments:
        $cache: ~
```

Symfony Profiler integration
----------------------------

[](#symfony-profiler-integration)

When the Symfony Profiler is available, a "Feature Flags" panel is added to the toolbar. It shows:

- The number of flags checked during the request and how many are enabled.
- Flags marked as "Must be cleaned before removal" (locked), as a reminder to remove them from the code.
- Unknown flags: flags checked in the code but not found in the database.

The toolbar and menu highlight in warning colour when locked or unknown flags are detected.

Entity reference
----------------

[](#entity-reference)

PropertyTypeDescription`name``string`Unique snake\_case identifier.`description``string`Human-readable description.`isEnabled``bool`Whether the flag is currently active.`isLocked``bool`Whether the flag is frozen and pending code cleanup.`createdAt``DateTimeImmutable`Set automatically on creation.`enabledAt``DateTimeImmutable|null`Set when the flag is first enabled, reset on disable.`lockedAt``DateTimeImmutable|null`Set when the flag is locked.License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance95

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

23d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04a3720d69f934d56e9015330abe9eba083ca08fb08de543b2d803a24247cf69?d=identicon)[devexploris](/maintainers/devexploris)

---

Top Contributors

[![DevExploris](https://avatars.githubusercontent.com/u/112415977?v=4)](https://github.com/DevExploris "DevExploris (1 commits)")

---

Tags

symfonybundletwigprofilerormdoctrineflagsfeature toggletogglefeature-flags

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devexploris-shizuku-feature-flags/health.svg)

```
[![Health](https://phpackages.com/badges/devexploris-shizuku-feature-flags/health.svg)](https://phpackages.com/packages/devexploris-shizuku-feature-flags)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
