PHPackages                             juststeveking/laravel-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. juststeveking/laravel-feature-flags

ActiveLibrary

juststeveking/laravel-feature-flags
===================================

A simple to use Feature Flags package for Laravel

1.4.0(2y ago)17650.7k↓31.3%12[2 PRs](https://github.com/JustSteveKing/laravel-feature-flags/pulls)MITPHPPHP ^8.1

Since Sep 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/JustSteveKing/laravel-feature-flags)[ Packagist](https://packagist.org/packages/juststeveking/laravel-feature-flags)[ Docs](https://github.com/JustSteveKing/laravel-feature-flags)[ GitHub Sponsors](https://github.com/JustSteveKing)[ RSS](/packages/juststeveking-laravel-feature-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (10)Used By (0)

Laravel Feature Flags
=====================

[](#laravel-feature-flags)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/8fc2e5f1299730b66b421a275ebf31fe649f5a59652a9b89a8e74e9089e0e864/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a75737473746576656b696e672f6c61726176656c2d666561747572652d666c6167732e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Run Tests](https://github.com/JustSteveKing/laravel-feature-flags/actions/workflows/tests.yml/badge.svg)](https://github.com/JustSteveKing/laravel-feature-flags/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/a28d841a176c620b6c9567eb50539f1398eff8892213dac81b7f22fc866f1a39/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a75737473746576656b696e672f6c61726176656c2d666561747572652d666c6167732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/laravel-feature-flags)[![Total Downloads](https://camo.githubusercontent.com/0f7fd58d8dca1823957f56ba4cd97ffc7a77899e431ff7ebc1ef2ea777fcd4c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a75737473746576656b696e672f6c61726176656c2d666561747572652d666c6167732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juststeveking/laravel-feature-flags)

[![](banner.png)](banner.png)

**I recommend using laravel/pennant for any future Feature Flag needs. This package will be frozen as is with no updates planned.**

A simple to use Feature Flag package for Laravel, allowing you to create Feature Groups and assign Users to them - while also being able to give users override access to given features outside of their groups.

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

[](#installation)

You can install the package via composer:

```
composer require juststeveking/laravel-feature-flags
```

You can publish the migrations files with:

```
php artisan vendor:publish --provider="JustSteveKing\Laravel\FeatureFlags\FeatureFlagsServiceProvider" --tag="migrations"
```

You can publish the config file with:

```
php artisan vendor:publish --provider="JustSteveKing\Laravel\FeatureFlags\FeatureFlagsServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [
    'middleware' => [
        'mode' => 'abort',

        'redirect_route' => '/',

        'status_code' => 404,
    ],

    'enable_time_bombs' => false,

    'time_bomb_environments' => ['production']
];
```

You will then need to migrate the database changes:

```
php artisan migrate
```

Usage
-----

[](#usage)

This package allows you to manage user features and feature groups in a database.

**All Feature and Feature Group names will be normalised to lower case on save.**

To use this package your User model needs to have the `HasFeatures` trait:

```
