Laravel Pennant: Feature Flags Made Easy
January 16, 2026
•
1 min read
•
38 views
Table of Contents
Feature flags with Pennant:
Installation
composer require laravel/pennant
php artisan vendor:publish --provider="Laravel\Pennant\PennantServiceProvider"
Define Feature
Feature::define('new-dashboard', function (User $user) {
return $user->isAdmin() || $user->isBetaTester();
});
Check Feature
if (Feature::active('new-dashboard')) {
return view('dashboard.new');
}
Feature::when('new-dashboard',
fn() => view('new'),
fn() => view('old')
);
Blade Directive
@feature('new-dashboard')
@endfeature
Related Posts
Laravel Sanctum API Authentication Complete Guide
Build secure API authentication with Laravel Sanctum for SPAs and mobile apps.
Laravel Rate Limiting: Protect Your Application
Implement rate limiting to protect your Laravel application from abuse.
Laravel Blade Components: Build Reusable UI
Create powerful reusable components with Laravel Blade.
Comments (0)
No comments yet. Be the first to comment!