Laravel

Laravel Pennant: Feature Flags Made Easy

January 16, 2026 1 min read 38 views

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
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!