PHPackages                             mohamedmohamedhekal/flagdeck - 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. mohamedmohamedhekal/flagdeck

Abandoned → [mohamedhekal/flagdeck](/?search=mohamedhekal%2Fflagdeck)Library

mohamedmohamedhekal/flagdeck
============================

Production-ready feature flags, percentage rollouts, and tenant targeting for Laravel

v0.1.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Jul 16Pushed 1mo agoCompare

[ Source](https://github.com/mohamedhekal/flagdeck)[ Packagist](https://packagist.org/packages/mohamedmohamedhekal/flagdeck)[ Docs](https://github.com/mohamedhekal/flagdeck)[ RSS](/packages/mohamedmohamedhekal-flagdeck/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (12)Versions (2)Used By (0)

FlagDeck
========

[](#flagdeck)

Production-minded feature flags for Laravel: boolean switches, percentage rollouts, and first-class user/tenant targeting—without a hosted feature-flag SaaS.

[![Tests](https://github.com/mohamedhekal/flagdeck/actions/workflows/tests.yml/badge.svg)](https://github.com/mohamedhekal/flagdeck/actions/workflows/tests.yml)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

> Replace the badge URLs with your GitHub org/user once the repository is published.

Problem
-------

[](#problem)

Shipping entitlements and gradual rollouts usually means either:

- hard-coded `if` checks that rot across the codebase, or
- a third-party flag service that is expensive and adds another operational dependency.

Laravel’s built-in options are intentionally minimal. Multi-tenant SaaS apps need allow/deny lists per tenant, sticky percentage buckets, cacheable evaluation, and an audit trail of who changed what.

Features
--------

[](#features)

- Boolean flags with a master enable switch
- Percentage rollouts with sticky bucketing
- User and tenant include/exclude lists
- Environment-scoped flags
- Cache-backed definition reads with bust-on-write
- `FlagDeck` facade + `feature:` middleware + Blade `@feature`
- Optional management HTTP API (disabled by default)
- Mutation audit log
- Artisan commands for list/set/cache clear

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

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12

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

[](#installation)

```
composer require mohamedhekal/flagdeck
```

Publish config (optional) and run migrations:

```
php artisan vendor:publish --tag=flagdeck-config
php artisan migrate
```

Quick start
-----------

[](#quick-start)

```
use Hekal\FlagDeck\Facades\FlagDeck;
use Hekal\FlagDeck\DTOs\EvaluationContext;

FlagDeck::create([
    'key' => 'checkout.express',
    'name' => 'Express Checkout',
    'is_enabled' => true,
    'percentage' => 20,
    'include_tenant_ids' => ['beta-customer'],
]);

if (FlagDeck::active('checkout.express')) {
    // ...
}

// Explicit context (tests, jobs, impersonation)
FlagDeck::active('checkout.express', new EvaluationContext(
    userId: '42',
    tenantId: 'acme',
    environment: 'production',
));
```

### Middleware

[](#middleware)

```
Route::middleware('feature:checkout.express')->group(function () {
    Route::get('/checkout/express', ExpressCheckoutController::class);
});
```

### Blade

[](#blade)

```
@feature('checkout.express')

@endfeature
```

### Artisan

[](#artisan)

```
php artisan flagdeck:set checkout.express --enable --percentage=25 --name="Express Checkout"
php artisan flagdeck:list
php artisan flagdeck:clear-cache
```

Configuration
-------------

[](#configuration)

See `config/flagdeck.php` after publishing. Important knobs:

KeyMeaning`missing_flag``inactive` (default, fail closed) or `active``cache.*`Store, TTL, prefix`bucketing.salt`Changing salt reshuffles percentage cohorts`api.enabled`Expose management routes (keep behind auth)`context.*`Callables to resolve user/tenant/anonymous idsArchitecture overview
---------------------

[](#architecture-overview)

Definitions live in `feature_flags`. Evaluation is pure given a `FlagDefinition` + `EvaluationContext`. Reads go through a cached repository decorator; writes audit and invalidate cache.

Details: [docs/architecture.md](docs/architecture.md) · [docs/evaluation.md](docs/evaluation.md)

Management API
--------------

[](#management-api)

Disabled by default. When enabled:

MethodPathPurposeGET`/flagdeck/flags`ListPOST`/flagdeck/flags`CreateGET`/flagdeck/flags/{key}`ShowPUT/PATCH`/flagdeck/flags/{key}`UpdateDELETE`/flagdeck/flags/{key}`DeleteGET`/flagdeck/evaluate/{key}`Debug evaluate (also gated)Configure middleware in `flagdeck.api.middleware`. Do not expose evaluate in production without auth.

Testing
-------

[](#testing)

```
composer install
composer test
```

Security
--------

[](#security)

- Fail closed for missing flags when gating entitlements.
- Keep the management API authenticated and authorized.
- Treat bucket salt as sensitive configuration (rotation redistributes users).
- See [SECURITY.md](SECURITY.md).

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

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md).

Roadmap
-------

[](#roadmap)

See [ROADMAP.md](ROADMAP.md). Filament admin, schedules, and experiments are intentionally not claimed as complete in v0.1.

FAQ
---

[](#faq)

**How is this different from Laravel Pennant?**
Pennant is a great lightweight toggle API. FlagDeck focuses on multi-tenant targeting, sticky rollouts, audit, optional HTTP management, and an evaluation model aimed at SaaS entitlements.

**Can I use it without Redis?**
Yes. Any Laravel cache store works; `array`/`file`/`database` are fine for smaller apps.

**What happens if percentage is set but the user is anonymous?**
Evaluation falls back through configured bucket sources. If none resolve, percentage flags evaluate inactive (fail closed).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

Credits
-------

[](#credits)

Built and maintained by Mohamed Hekal.

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9d7c092a109fe780c7efd87ce4142eae2c0cec0f92fd1e87e769bec5661953b?d=identicon)[mohamedhekal](/maintainers/mohamedhekal)

---

Top Contributors

[![mohamedhekal](https://avatars.githubusercontent.com/u/21014387?v=4)](https://github.com/mohamedhekal "mohamedhekal (5 commits)")

---

Tags

feature-flagslaravellaravel-packagemulti-tenancyphpsaasphplaravellaravel-packagesaasmulti-tenancyfeature-flagsfeature-togglesfeature flagab-testingentitlementsexperimentationrollouts

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mohamedmohamedhekal-flagdeck/health.svg)

```
[![Health](https://phpackages.com/badges/mohamedmohamedhekal-flagdeck/health.svg)](https://phpackages.com/packages/mohamedmohamedhekal-flagdeck)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k17.6M166](/packages/laravel-pulse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M272](/packages/laravel-mcp)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

1.0k2.5M153](/packages/roots-acorn)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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