Laravel Pennant Development

laravel/boost

Implement and manage feature flags in Laravel with Pennant, including scopes and gradual rollouts.

Contenuto aggiornato: SKILL.md
Punteggio di qualità 78/100
composer require laravel/boost --dev && php artisan boost:install
3690Stelle386ForkUltimo push del repository

Informazioni sullo Skill

Implement and manage feature flags in Laravel with Pennant, including scopes and gradual rollouts.

SKILL.md

Autore: Laravel · laravel/boost · MIT · SKILL.md @ 6004f09

---
name: pennant-development
description: "Use when working with Laravel Pennant the official Laravel feature flag package. Trigger whenever the query mentions Pennant by name or involves feature flags or feature toggles in a Laravel project. Tasks include defining feature flags checking whether features are active creating class based features in `app/Features` using Blade `@feature` directives scoping flags to users or teams building custom Pennant storage drivers protecting routes with feature flags testing feature flags with Pest or PHPUnit and implementing A B testing or gradual rollouts with feature flags. Do not trigger for generic Laravel configuration authorization policies authentication or non Pennant feature management systems."
license: MIT
metadata:
  author: laravel
---
# Pennant features

## Documentation

Use `search-docs` for detailed Pennant patterns and documentation.

## Basic usage

### Defining features

<!-- Defining Features -->
```php
use Laravel\Pennant\Feature;

Feature::define('new-dashboard', function (User $user) {
    return $user->isAdmin();
});
```

### Checking features

<!-- Checking Features -->
```php
if (Feature::active('new-dashboard')) {
    // Feature is active
}

// With scope
if (Feature::for($user)->active('new-dashboard')) {
    // Feature is active for this user
}
```

### Blade directive

<!-- Blade Directive -->
```blade
@feature('new-dashboard')
    <x-new-dashboard />
@else
    <x-old-dashboard />
@endfeature
```

### Activating and deactivating

<!-- Activating Features -->
```php
Feature::activate('new-dashboard');
Feature::for($user)->activate('new-dashboard');
```

## Verification

1. Check that the feature flag is defined
2. Test with different scopes and users

## Common pitfalls

- Forgetting to scope features for specific users or other entities
- Not following existing naming conventions

Perché lo abbiamo scelto

Official Laravel Boost guidance. This listing is based on repository and documentation review; the workflows were not executed.

Prima di usarlo

  • A Laravel project with Composer and Laravel Boost installed; Boost installs guidance according to the project, packages and assistant selected.
  • Laravel Pennant is needed for the feature-flag workflow.

Agenti supportati

Claude CodeCodex CLICursor

Fonti e riferimenti

Le fonti originali sono collegate qui sotto. Gli spunti pratici sono suggerimenti editoriali di SkillHey.