PHPackages                             chemaclass/laravel-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. chemaclass/laravel-feature-flags

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

chemaclass/laravel-feature-flags
================================

Agnostic feature flag management for Laravel with optional admin UI and per-scope overrides.

v0.1.0(3w ago)03MITPHPPHP ^8.3CI passing

Since May 15Pushed 3w agoCompare

[ Source](https://github.com/Chemaclass/laravel-feature-flags)[ Packagist](https://packagist.org/packages/chemaclass/laravel-feature-flags)[ Docs](https://github.com/Chemaclass/laravel-feature-flags)[ Fund](https://chemaclass.com/sponsor)[ RSS](/packages/chemaclass-laravel-feature-flags/feed)WikiDiscussions main Synced 1w ago

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

laravel-feature-flags
=====================

[](#laravel-feature-flags)

[![CI](https://github.com/Chemaclass/laravel-feature-flags/actions/workflows/ci.yml/badge.svg)](https://github.com/Chemaclass/laravel-feature-flags/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/80664f900ca5e56223294254fe7739e8e32ddfaafd40230623614a6e7768da45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368656d61636c6173732f6c61726176656c2d666561747572652d666c6167732e737667)](https://packagist.org/packages/chemaclass/laravel-feature-flags)[![Packagist Downloads](https://camo.githubusercontent.com/7c95950de6112558fe6c3ca44d1d16eeb8e41b0f3b2d587586e527887fcf7a30/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368656d61636c6173732f6c61726176656c2d666561747572652d666c6167732e737667)](https://packagist.org/packages/chemaclass/laravel-feature-flags)[![PHP](https://camo.githubusercontent.com/31a87e1f22b529af58a2615dde6bcd4902061209db5e98adc4b5dff3e99f5f02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](composer.json)[![Laravel](https://camo.githubusercontent.com/f9db1c371c44b9b3022926566e44c5ddc9cf13fa1fcd3eec48d8d0e0214fb073/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312e7825323025374325323031322e782d4646324432303f6c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](composer.json)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

Agnostic, DB-backed feature flags for Laravel. Global toggles, per-scope overrides, time windows, dev markers, middleware guard, and a zero-build Blade admin page with dark mode.

> Drop it in any Laravel app. No vendor lock-in, no opinionated stack, no assumptions about your domain.

Highlights
----------

[](#highlights)

- **Agnostic**: a scope is whatever you want (team, org, region, cohort, user) via a `FeatureScopeResolver` contract
- **Per-scope overrides**: scoped row beats global; null scope = global default
- **Time windows**: `enabled_from` / `enabled_until` gating
- **Dev marker**: `is_dev` flag for filtering in non-prod environments
- **Type-safe keys**: enum-based `FeatureKey` contract
- **Facade + middleware**: `FeatureFlag::isEnabled(...)` and the `feature.enabled` route guard
- **Admin UI**: published Blade page with toggle switches, inline edits, dark mode, scope grouping
- **Repository pattern**: swap `EloquentFeatureFlagRepository` for any backend

Install
-------

[](#install)

```
composer require chemaclass/laravel-feature-flags
php artisan vendor:publish --tag=feature-flags
php artisan migrate
```

The single `feature-flags` tag publishes the config, the migration, the admin view, and the admin routes file. See [docs/installation.md](docs/installation.md) for per-tag installs.

30-second usage
---------------

[](#30-second-usage)

```
use Chemaclass\FeatureFlags\Contracts\FeatureKey;
use Chemaclass\FeatureFlags\Facades\FeatureFlag;

enum AppFeature: string implements FeatureKey
{
    case NewDashboard = 'new-dashboard';

    public function key(): string { return $this->value; }
}

// Global check
if (FeatureFlag::isEnabled(AppFeature::NewDashboard)) {
    // gated code
}

// Scoped check. $scopeId is whatever string your app decides on
// (team id, organization id, region code, cohort name, etc.)
if (FeatureFlag::isEnabled(AppFeature::NewDashboard, $scopeId)) {
    // gated code
}
```

Full API on the facade: `isEnabled`, `all`, `create`, `update`, `updateOrCreate`, `delete`, `toggleValue`, `toggleDevByKey`, `findById`, `findByKeyAndScope`. See [docs/usage.md](docs/usage.md).

Route guard:

```
use Chemaclass\FeatureFlags\Http\Middleware\EnsureFeatureIsActive;

Route::get('/dashboard', DashboardController::class)
    ->middleware(EnsureFeatureIsActive::using(AppFeature::NewDashboard));

// or via alias
Route::get('/dashboard', DashboardController::class)
    ->middleware('feature.enabled:new-dashboard');
```

Admin UI
--------

[](#admin-ui)

Visit `/admin/feature-flags` (configurable, gated by `web`+`auth` by default). Features:

- Flags grouped by key, global row tinted, scope overrides nested
- Real sliding toggle switches, inline hint and time-window editing
- Per-row and per-key dev marker toggles
- Add scope override / new flag forms
- Dark mode toggle, default follows OS
- Color-hashed scope badges

See [docs/admin-ui.md](docs/admin-ui.md).

Documentation
-------------

[](#documentation)

TopicLinkInstallation &amp; setup[docs/installation.md](docs/installation.md)Configuration reference[docs/configuration.md](docs/configuration.md)Defining &amp; checking flags[docs/usage.md](docs/usage.md)Scope resolvers[docs/scopes.md](docs/scopes.md)Middleware guard[docs/middleware.md](docs/middleware.md)Admin UI[docs/admin-ui.md](docs/admin-ui.md)Custom repository / storage[docs/extending.md](docs/extending.md)Testing[docs/testing.md](docs/testing.md)Recipes &amp; patterns[docs/recipes.md](docs/recipes.md)Architecture overview[docs/architecture.md](docs/architecture.md)Publish tags
------------

[](#publish-tags)

TagWhat it publishes`feature-flags`All of the below in one shot`feature-flags-config``config/feature-flags.php``feature-flags-migrations`DB migration`feature-flags-views`Blade admin view`feature-flags-routes`Admin routes fileRequirements
------------

[](#requirements)

- PHP `^8.3`
- Laravel `^11.0 || ^12.0`

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for local dev setup, the Docker demo app, the test suites, formatting, and the `release.sh` flow.

License
-------

[](#license)

MIT.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance94

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

25d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

---

Top Contributors

[![Chemaclass](https://avatars.githubusercontent.com/u/5256287?v=4)](https://github.com/Chemaclass "Chemaclass (50 commits)")

---

Tags

laravelfeature-flagstogglesscoped

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chemaclass-laravel-feature-flags/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

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