PHPackages                             patipattip/filament-feature-flags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. patipattip/filament-feature-flags

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

patipattip/filament-feature-flags
=================================

Filament implementation of feature flags and segmentation with Laravel Pennant.

01501PHP

Since May 1Pushed 2y agoCompare

[ Source](https://github.com/patipattip/filament-feature-flags)[ Packagist](https://packagist.org/packages/patipattip/filament-feature-flags)[ RSS](/packages/patipattip-filament-feature-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Filament Feature Flags
======================

[](#filament-feature-flags)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d3310a06e299e8e3d93dd99b54c3766f2745a34c5c19762a0d43b94471c1491c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374657068656e6a7564652f66696c616d656e742d666561747572652d666c6167732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/filament-feature-flags)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3976565055f01e03f39228f687ba293d8bfefd7c02ab92915866cda06662d28d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f66696c616d656e742d666561747572652d666c6167732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/stephenjude/filament-feature-flags/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d2f4cea7d55469998011ecf1bdbc030f08aa50e294bd645407e4920a0935f5e3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7374657068656e6a7564652f66696c616d656e742d666561747572652d666c6167732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/stephenjude/filament-feature-flags/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/86b2e334afd95e558a2e4f4e18a9cc888241e6c7f205b704280b4792735c16bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374657068656e6a7564652f66696c616d656e742d666561747572652d666c6167732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stephenjude/filament-feature-flags)

Filament implementation of feature flags and segmentation with Laravel Pennant.

- Apply features for a **segment** of users (i.e., by country or currency)
- Apply features for **individual** users (i.e., by email or ID)
- Apply features for **all** users
- Create custom feature segmentation
- Feature event handling (i.e., run code when a feature is activated/deactivated)
- UI to modify a segment of users
- Purge all resolved features from storage

[![](./art/segments.png)](./art/segments.png)

Learn More
----------

[](#learn-more)

- [A Feature Flags Implementation for Filament - Laravel News](https://laravel-news.com/filament-feature-flags)

Installation
------------

[](#installation)

You can install the package via composer and publish and run the migrations with:

```
composer require stephenjude/filament-feature-flags

php artisan vendor:publish --provider="Laravel\Pennant\PennantServiceProvider"

php artisan vendor:publish --provider="Stephenjude\FilamentFeatureFlag\FeatureFlagPluginServiceProvider"

php artisan migrate
```

Usage
-----

[](#usage)

You'll have to register the plugin in your panel provider.

```
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            Stephenjude\FilamentFeatureFlag\FeatureFlagPlugin::make()
        );
}
```

Create Class Based Feature
--------------------------

[](#create-class-based-feature)

To create a class based feature, you may invoke the pennant:feature Artisan command.

```
php artisan pennant:feature WalletFunding
```

When writing a feature class, you only need to use the `Stephenjude\FilamentFeatureFlag\Traits\WithFeatureResolver`trait, which will be invoked to resolve the feature's initial value for a given scope.

```
