PHPackages                             jtgrimes/laravel-simple-featureflag - 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. jtgrimes/laravel-simple-featureflag

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

jtgrimes/laravel-simple-featureflag
===================================

A quick and dirty feature flag for Laravel

0333PHP

Since Jun 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jtgrimes/laravel-simple-featureflag)[ Packagist](https://packagist.org/packages/jtgrimes/laravel-simple-featureflag)[ RSS](/packages/jtgrimes-laravel-simple-featureflag/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

laravel-simple-featureflag
==========================

[](#laravel-simple-featureflag)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9dfe6c2b71557041ed985814eed67d3d07c5532bc873b2f9f5b8de1d78768630/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4a544772696d65732f6c61726176656c2d73696d706c652d66656174757265666c61672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/JTGrimes/laravel-simple-featureflag)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/25d7fc82f4fa947d9b934b612267dafaa4e84e50e4a9d093faf74caecff627af/68747470733a2f2f7472617669732d63692e6f72672f6a746772696d65732f6c61726176656c2d73696d706c652d66656174757265666c61672e7376673f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://travis-ci.org/JTGrimes/laravel-simple-featureflag)[![Quality Score](https://camo.githubusercontent.com/d0fbd6e6ce09e51e7a05cd7e1c1b1402f5a47d5ca209666a89d6a118f5d8a846/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a746772696d65732f6c61726176656c2d73696d706c652d66656174757265666c61672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/jtgrimes/laravel-simple-featureflag/?branch=master)

This package gives you a quick and dirty way to use feature flags in Laravel 5+. It doesn't provide configuration by user, nor is it set up for A/B tests. It's a simple on/off switch.

Install
-------

[](#install)

Install the package with Composer:

```
$ composer require JTGrimes/laravel-simple-featureflag
```

You'll need to update the providers array in `config/app.php`with the service provider for this package:

```
'providers' => [
    ...
    JTGrimes\FeatureFlag\ServiceProvider::class,
];
```

Finally, you'll need to publish the configuration file: You can publish the migration with:

```
$ php artisan vendor:publish --provider="JTGrimes\FeatureFlag\ServiceProvider"
```

Configuration
-------------

[](#configuration)

The default configuration file is shown below. The array keys are the names of the features that you're using feature flags for and the values are true/false based on whether the feature is enabled. (My convention is to set a FEATURE\_\* .env variable to 'on' or 'off', but any expression which is truthy will work.) Any feature which is not found in the config file will default to being enabled.

```
return [
    'something' => (env('FEATURE_SOMETHING', 'on') == 'on'),
    'something_else' => (env('SOME_OTHER_FEATURE', 'on') == 'on'),
    'one_more' => false,
];
```

Usage
-----

[](#usage)

The package provides a helper function. To determine whether a feature is enabled, you can call the `feature()` function from anywhere in your code.

```
   $permitAccess = feature('name');
```

I often find myself using this function in middleware to prevent access to pages which aren't available yet ...

```
        if (!feature('v2')) {
            if (str_contains($request->getUri(), 'v2')) {
                abort(Response::HTTP_NOT_FOUND);
            }
        }
        return $next($request);
```

There are also helpers for your Blade views:

```
@ifFeature ('test')
    Feature on
@else
    Feature off
@endif
```

`@else` is optional, but you must include `@endif` to close the if statement.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [J.T. Grimes](https://github.com/jtgrimes)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c319ec5d12ff7f655d70ebd4ad5d0ac9d364bfb12524834290f4d1c0953751b0?d=identicon)[jtgrimes](/maintainers/jtgrimes)

---

Top Contributors

[![jtgrimes](https://avatars.githubusercontent.com/u/3291952?v=4)](https://github.com/jtgrimes "jtgrimes (7 commits)")

### Embed Badge

![Health badge](/badges/jtgrimes-laravel-simple-featureflag/health.svg)

```
[![Health](https://phpackages.com/badges/jtgrimes-laravel-simple-featureflag/health.svg)](https://phpackages.com/packages/jtgrimes-laravel-simple-featureflag)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
