ryangjchandler/filament-feature-flags

This package is abandoned and no longer maintained. No replacement package was suggested.

Control your Laravel feature flags through a clean Filament interface.

v1.0.4 2022-11-23 11:17 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

Empty resource

Adding a new flag

To add a new flag, click the "Add Feature" button and you'll be presented with a form.

Empty create 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.

Resource type

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.

Resource searching

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.

Table overview

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.