ryangjchandler / filament-feature-flags
Control your Laravel feature flags through a clean Filament interface.
Fund package maintenance!
ryangjchandler
Installs: 1 713
Dependents: 1
Suggesters: 0
Security: 0
Stars: 47
Watchers: 1
Forks: 7
Open Issues: 0
Requires
- php: ^8.1
- filament/filament: ^2.16
- illuminate/contracts: ^9.0
- ryangjchandler/laravel-feature-flags: ^1.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- filament/support: ^2.12
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-01-07 23:27:05 UTC
README
This packages provide a graphical wrapper around ryangjchandler/laravel-feature-flags.
Installation
You can install the package via Composer:
composer require ryangjchandler/filament-feature-flags
You should also follow the installation instructions for underlying package;
Usage
Once installed, this package will register a new "Features" resource.
Adding a new flag
To add a new flag, click the "Add Feature" button and you'll be presented with a form.
The only required field in the form is the "Name" field. The "Description" field is optional and only serves as metadata for users.
You can toggle the value of flag by switching the toggle input labelled "Enabled".
Scoping a flag to a resource / model
You should follow the documentation on setting up models for feature flags before continuing.
Being by implementing the RyanChandler\FilamentFeatureFlags\Contracts\FlaggableResource
interface on your chosen Resource
class.
use RyanChandler\FilamentFeatureFlags\Contracts\FlaggableResource; class CustomerResource extends Resource implements FlaggableResource { public static function getFlaggableRecordDisplayColumn(): string { return 'name'; } }
The getFlaggableRecordDisplayColumn()
method should return the name of the column you'd like to display when searching for your flaggable records.
Now that you've implemented the FlaggableResource
interface, you should be able to see your resource show up as an option in the "Resource Type" field.
If you select the resource, you'll see a new "Resource" field appear underneath. This field is a searchable Select
field and can be used to search for and choose the record this flag is associated with.
Once you've selected a record, save the feature flag and it will be associated with it.
Table
The table will show all flags, including flags associated with models / resources.
The "Name" field is searchable and the "Enabled" column can be clicked to toggle the flag.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.