beqqaa/laravel-feature-flags

Simple, extendable and automated feature flag system for Laravel

v0.0.2 2025-04-07 21:51 UTC

This package is auto-updated.

Last update: 2025-09-07 23:25:49 UTC


README

A simple, extendable, and automated feature flag system for Laravel.
Supports caching, automatic API routing, and publishable configuration & migrations.

๐Ÿš€ Features

  • โœ… Feature toggling using database
  • โœ… Facade and service-based access
  • โœ… Publishable migration & config
  • โœ… Automatic route registration for REST API
  • โœ… Ready for integration with external admin UI

๐Ÿ“ฆ Installation

composer require beqqaa/laravel-feature-flags

If you're using Laravel 8โ€“11, you're good to go.

๐Ÿ”ง Publish Config & Migration

php artisan vendor:publish --tag=feature-flags-config
php artisan vendor:publish --tag=feature-flags-migrations
php artisan migrate

โœ… Usage

Enable a feature

Feature::enable('new_checkout');

Disable a feature

Feature::disable('new_checkout');

Check if a feature is enabled

if (Feature::isEnabled('new_checkout')) {
    // Show new checkout
}

๐Ÿง  API Endpoints

Method Endpoint Description
GET /api/feature-flags Get all feature flags
POST /api/feature-flags Create new flag
PUT /api/feature-flags/{key} Update flag status
DELETE /api/feature-flags/{key} Delete flag

Endpoint prefix and middleware can be configured.

โš™๏ธ Configuration (config/feature-flags.php)

return [
    'cache_ttl' => 60, // In minutes. Set to 0 to disable caching.

    'route_prefix' => 'api/feature-flags',

    'middleware' => ['api'], // Add 'auth:sanctum' or others as needed
];

๐Ÿงฉ React Admin UI (Optional)

This package is backend-only.
To manage flags visually, check out the upcoming frontend dashboard (React + Vite) at:

Coming soon: beqqaa/feature-flags-dashboard

๐Ÿงช Testing & Development

Coming soon: unit tests and mock support.

๐Ÿค Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss.

๐Ÿ“„ License

MIT ยฉ beqqaa