Download the PHP package webrek/laravel-feature-flags without Composer
On this page you can find all versions of the php package webrek/laravel-feature-flags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webrek/laravel-feature-flags
More information about webrek/laravel-feature-flags
Files in webrek/laravel-feature-flags
Package laravel-feature-flags
Short Description Feature flags for Laravel with percentage rollouts, rule-based targeting and A/B variants.
License MIT
Homepage https://github.com/webrek/laravel-feature-flags
Informations about the package laravel-feature-flags
Laravel Feature Flags
Feature flags for Laravel with percentage rollouts, rule-based targeting and A/B variants — turn features on or off at runtime without a deploy.
Quick start
Why not just use your own boolean column
A boolean column on a settings table answers a single question: is it on for
everyone? Real feature work needs more:
- Gradual rollout. Ship to 5% of users, watch your metrics, bump it to 25%, then to 100% — and a user who was in the 5% stays in as you scale, because bucketing is deterministic, not random on every request.
- Targeting. "Enterprise plans only", "users in MX and US", "accounts older than 30 days" — expressed as constraints, not as branches scattered throughout your code.
- A/B variants. Assign each user a stable variant (
bluevsgreen) and measure which one converts. - Runtime control. Turn a flag on or off from the database or an artisan command without a deploy, and instantly disable a feature that is misbehaving.
This package does all of that and, unlike Laravel Pennant, stores rollouts, constraints and variants as data you can manage — not just as closures in code.
Defining features
With the database store (the default), define and manage them at runtime:
Or declare them in code with the array store (ideal for tests or simple
applications) — set FEATURE_FLAGS_STORE=array and populate config/feature-flags.php:
Checking features
A feature resolves as active only when every gate passes: the master switch is on, the scope satisfies all constraints, it falls within the rollout percentage and (for a feature with variants) a variant is assigned.
Scopes
Pass anything as a scope:
null(or omit it) — the authenticated user, falling back to a global scope.- An Eloquent model — bucketed by class + key; its attributes feed targeting.
- Anything implementing
FeatureScope— you control the identifier and the attributes exposed to constraints. - A string or int — used directly as the bucketing identity.
Targeting constraints
Each constraint is ['attribute' => ..., 'operator' => ..., 'value' => ...] and
all of them must be satisfied. Supported operators:
= · != · in · not_in · > · >= · < · <= · contains
Blade and middleware
Artisan
Dashboard
A built-in web interface for toggling features, adjusting rollout and creating or deleting flags
at runtime — no deploy, no database client. It is server-rendered (no JS build,
no CDN) and lives at /feature-flags by default.
The dashboard controls your flags, so protect it. Add authentication/authorization middleware (for example,
['web', 'auth', 'can:manage-features']) and, in production, restrict who can access it. It manages the active store, so use the database store. Publish the views to customize them:
Requirements
| Component | Version |
|---|---|
| PHP | 8.2+ |
| Laravel | 12.x / 13.x |
Testing
Contributing
See CONTRIBUTING.md.
Security
Please review the security policy before reporting a vulnerability.
License
The MIT License (MIT). See LICENSE.
All versions of laravel-feature-flags with dependencies
illuminate/contracts Version ^12.0 || ^13.0
illuminate/database Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0