Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
laravel-pennant-feature-flags
laravel-pennant-feature-flags
alizharb/agent-skills
claude-code
feature-flags
pennant
beta-testing
continuous-delivery
class-based-features
blade-directives

Use when creating feature toggles, checking flag status, or configuring class-based features using Laravel Pennant.

Install
php artisan boost:add-skill alizharb/agent-skills

Save this content to: .claude/skills/laravel-pennant-feature-flags/SKILL.md

# Laravel Pennant Feature Flags

## When To Use

Use this skill when implementing continuous delivery, beta-testing features for specific users, or configuring runtime flags.

## Workflow

1. **Verify setup**: Ensure `laravel/pennant` is installed and driver settings are configured (`config/pennant.php`).
2. **Define Feature Flag**: Register feature toggles inside `AppServiceProvider`.
3. **Class-Based Flags**: Use class-based features for complex flag calculations.
4. **Conditional checks**: Check flags inside controllers, middleware, or Blade templates cleanly.

## Examples

### Good Example

```php
// app/Providers/AppServiceProvider.php
namespace App\Providers;

use Laravel\Pennant\Feature;
use App\Models\User;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        // Define simple check
        Feature::define('beta-dashboard', function (User $user) {
            return $user->inBetaGroup();
        });
    }
}
```

```blade
{{-- Blade check --}}
@feature('beta-dashboard')
    <x-beta-dashboard-widget />
@else
    <x-standard-dashboard-widget />
@endfeature
```

### Bad Example

```php
// ❌ Using hardcoded config values or database user flags manually for feature toggling.
if (config('app.features.beta_enabled') && auth()->user()->is_beta) {
    // Boilerplate checks that are difficult to manage and test.
}
```

Laravel Pennant Feature Flags

When To Use

Use this skill when implementing continuous delivery, beta-testing features for specific users, or configuring runtime flags.

Workflow

  1. Verify setup: Ensure laravel/pennant is installed and driver settings are configured (config/pennant.php).
  2. Define Feature Flag: Register feature toggles inside AppServiceProvider.
  3. Class-Based Flags: Use class-based features for complex flag calculations.
  4. Conditional checks: Check flags inside controllers, middleware, or Blade templates cleanly.

Examples

Good Example

// app/Providers/AppServiceProvider.php
namespace App\Providers;

use Laravel\Pennant\Feature;
use App\Models\User;

class AppServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        // Define simple check
        Feature::define('beta-dashboard', function (User $user) {
            return $user->inBetaGroup();
        });
    }
}
{{-- Blade check --}}
@feature('beta-dashboard')
    <x-beta-dashboard-widget />
@else
    <x-standard-dashboard-widget />
@endfeature

Bad Example

// ❌ Using hardcoded config values or database user flags manually for feature toggling.
if (config('app.features.beta_enabled') && auth()->user()->is_beta) {
    // Boilerplate checks that are difficult to manage and test.
}
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log