Feature flags and entitlements for Filament v5 tenants: define features and plans in code, store per-tenant overrides and global kill switches, check limits against real usage, and gate pages, actions, routes and Blade with one call.
- Features and plans in code: on/off features and numeric limits, bundled into plans; the plan comes from any source.
- One call to check: whether a feature is on, its limit and what's left against real usage.
- Gating everywhere: routes, actions, form fields, pages and Blade, with an upgrade card when something is locked.
- Overrides: trials, beta access and custom limits per tenant, global kill switches, each with an expiry and a reason.
- Plan and admin pages: "Your plan" with usage bars for tenants, flags and overrides for operators.
- Works with Filament Teams: seat limits straight from the plan.
- Caching, commands and events: a per-request memo with an optional cache store, list and prune commands, events when a limit is hit.
| Plugin | Filament | Laravel | PHP |
|---|---|---|---|
| 1.x | 5.x | 12.x, 13.x | 8.3+ |
composer require packstub/filament-features
php artisan packstub-features:installuse Packstub\Features\FeaturesPlugin;
$panel->plugin(
FeaturesPlugin::make()
->features([
'api_access' => ['label' => 'API access', 'type' => 'boolean', 'default' => false, 'group' => 'Integrations'],
'projects' => ['label' => 'Projects', 'type' => 'limit', 'default' => 3, 'unit' => 'projects'],
])
->plans([
'free' => ['label' => 'Free', 'features' => ['projects' => 3]],
'pro' => ['label' => 'Pro', 'price' => '$29', 'features' => ['projects' => 50, 'api_access' => true]],
], default: 'free')
->planUsing(fn (?Team $team) => $team?->subscription?->plan) // or a `plan` column
->usage('projects', fn (?Team $team) => $team?->projects()->count() ?? 0)
->upgradeUrl(fn (?Team $team) => route('billing', $team)),
);Optionally add Packstub\Features\Concerns\HasFeatures to the tenant model for $team->hasFeature('api_access'), featureLimit(), featureRemaining(), canUseFeature().
Features::active('api_access'); // current Filament tenant
Features::active('api_access', $team);
Features::limit('projects', $team); // 50, or null = unlimited
Features::remaining('projects', $team);
Features::canUse('projects', $team);
Features::assertCanUse('projects', $team); // throws FeatureLimitReached / FeatureInactive
Features::for($team)->snapshot(); // every feature with value, source, usageRoute::get('/api/tokens', ...)->middleware('feature:api_access'); // 403
Route::get('/reports', ...)->middleware('feature:reports,redirect'); // → upgrade URL
Action::make('export')->requiresFeature('api_access');
TextInput::make('webhook_url')->requiresFeature('api_access');
class ReportsPage extends Page { use RequiresFeature; protected static string $feature = 'reports'; }@feature('api_access') … @else … @endfeature
<x-packstub-features::locked feature="api_access" />Features::enable($team, 'reports', now()->addDays(14), 'trial');
Features::override($team, 'projects', 100, reason: 'enterprise deal');
Features::override($team, 'projects', null); // unlimited
Features::disable(null, 'api_access'); // global kill switch
Features::clearOverride($team, 'reports');Resolution order: scope override → plan → global override → default.
Plan(tenant panel,/plan) — "Your plan": features by group, usage bars, upgrade button. Disable with->planPage(null).FeatureFlagsandFeatureOverrides(central/admin panel) —->adminPages(). Open to whoever can access a panel without tenancy; on a tenant panel they stay hidden unless->canManageUsing(fn (User $user) => ...)(or amanageFeaturesGate ability) says otherwise.
TeamsPlugin::make()->seatLimit(fn (Team $team) => Features::limit('seats', $team));See config/packstub-features.php: scope_model, features, plans, default_plan, overrides_table, connection, cache.store / ttl, upgrade_url. Anything can be overridden per panel with ->config([...]).
Commands: features:list prints every feature with its resolved value for a tenant, features:prune deletes expired overrides.
The same pages live in the docs/ directory of this repository.
composer testSee the changelog.
See CONTRIBUTING.
See our security policy.
The MIT License (MIT). See LICENSE.

