alfasix / alfakit-feature-flags
A feature flag control centre for Laravel Pennant in AlfaKit panels: every feature with its status, kill switch, percentage and scheduled rollouts, per-user and per-tenant targeting, rich values and a full audit trail.
Requires
- php: ^8.4
- alfasix/alfakit: ^0.1|@dev
- laravel/pennant: ^1.26
Requires (Dev)
None
Suggests
- alfasix/alfakit-activity-log: Also writes every feature flag change to the activity log.
Provides
None
Conflicts
None
Replaces
None
README
by Alfa Six
This is a read-only split of the AlfaKit monorepo. Please open issues and pull requests there.
A feature flag control centre for Laravel Pennant in AlfaKit panels: every feature with its status and counts, a kill switch, values for everyone, stable percentage rollouts, schedules, per-user and per-tenant targeting, rich values and a full audit trail. It renders in React, Vue and Svelte with AlfaKit's built-in components.
Installation
composer require alfasix/alfakit-feature-flags
php artisan vendor:publish --tag=pennant-migrations # Pennant's `features` table, if you don't have it yet
php artisan vendor:publish --tag=alfakit-feature-flags-migrations
php artisan migrate
Register
use AlfaSix\AlfakitFeatureFlags\FeatureFlagsPlugin; $panel->plugin( FeatureFlagsPlugin::make() ->authorize(fn (User $user): bool => $user->is_admin) ->scopes([ User::class => fn (Builder $query, ?string $search) => $query->where('email', 'like', "%{$search}%"), Team::class, ]), );
Nobody can open the pages until you pass authorize() or define the manageFeatureFlags gate.
use AlfaSix\AlfakitFeatureFlags\Concerns\FeatureFlagged; class Billing extends Page { use FeatureFlagged; protected static ?string $feature = 'new-billing'; }
Full documentation: https://alfakit.dev/docs/plugins/feature-flags