PHPackages                             matthiaswilbrink/laravel-feature-toggles - 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. matthiaswilbrink/laravel-feature-toggles

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

matthiaswilbrink/laravel-feature-toggles
========================================

Toggle parts of your application on or off

0.5.0(3y ago)1525PHPPHP ^7.2CI failing

Since Apr 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/matgeroe/laravel-feature-toggles)[ Packagist](https://packagist.org/packages/matthiaswilbrink/laravel-feature-toggles)[ RSS](/packages/matthiaswilbrink-laravel-feature-toggles/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Laravel feature toggles
=======================

[](#laravel-feature-toggles)

Toggle parts of you application on or off with zero downtime.

Deploy your feature at night, toggle it when your boss hits that big red button.
(big red button not included)

Features
--------

[](#features)

- Set the initial state of a feature in the config
- Use laravel's cache to limit database load
- Convenient commands to toggle features on/off

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

[](#installation)

This package is available on composer.
To install laravel-feature-toggles you can run the following command

```
composer require matthiaswilbrink/laravel-feature-toggles
```

After installation you can publish the configuration with this command

```
php artisan vendor:publish --provider="MatthiasWilbrink\FeatureToggle\Providers\FeatureToggleServiceProvider"
```

As this package uses a database to keep track of the features' state, you'll have to migrate after installing this package

```
php artisan migrate
```

Usage
-----

[](#usage)

CommandPurpose`feature:create`Read features from the config and inserts them into the database. Once inserted, it will *never* be overwritten.`feature:list`List all features in the database.`feature:enable`Enable a feature, pick from list.`feature:disable`Disable a feature, pick from list.`feature:clear-cache`Clear the feature cache, features will be stored in cache again when they are called for the first time.### Reading

[](#reading)

#### Blade

[](#blade)

A custom blade directive has been made.
In a blade file do the following:

```
[...]
@feature('name_of_my_feature_as_string')
    This will show when the feature is enabled
@endfeature
[...]
```

The else clause could also be used.

```
[...]
@feature('name_of_my_feature_as_string')
    This will show when the feature is enabled.
@else
    This will show when the feature is disabled.
@endfeature
[...]
```

#### Helper

[](#helper)

The helper function `feature(string $name)` return the state of the given feature.

```
if (feature('name_of_my_feature_as_string')){
    //do something
}
```

#### Facade

[](#facade)

An alias has been registered.

```
// Check if a feature is enabled
if (Feature::isEnabled('name_of_my_feature_as_string')){
    //do something
}

// A shorter alias
if (Feature::isOn('name_of_my_feature_as_string')){
    //do something
}
```

#### Dependency Injection

[](#dependency-injection)

Of course you can inject the FeatureManager to accomplish the same goal.

```
public function someMethod(FeatureManager $featureManager)
{
    if ($featureManager->isEnabled('name_of_my_feature_as_string')){
        //do something
    }
}
```

### Other activities

[](#other-activities)

You might also want to allow your users to enable or disable features. (Things like a Christmas theme come to mind)

```
public function turnTheSnowFlakesOn(FeatureManager $featureManager)
{
    $featureManager->enable('homepage_snowflakes_animation');
}
```

A note on caching
-----------------

[](#a-note-on-caching)

If caching is turned on, the cache is cleared and rebuild *every* time a feature is enabled/disabled.
Might the need arise you can always flush the cache with `php artisan feature:clear-cache`.
This will *only* flush the feature cache, not your regular application cache.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% 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.

###  Release Activity

Cadence

Every ~284 days

Total

5

Last Release

1434d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2675bf15fed8e4ad33b8fd72e83034499b2863429658d286ce92d27f32a1c607?d=identicon)[matgeroe](/maintainers/matgeroe)

---

Top Contributors

[![mwilbrink-hanzeict](https://avatars.githubusercontent.com/u/185896030?v=4)](https://github.com/mwilbrink-hanzeict "mwilbrink-hanzeict (8 commits)")[![matgeroe](https://avatars.githubusercontent.com/u/11758128?v=4)](https://github.com/matgeroe "matgeroe (5 commits)")

### Embed Badge

![Health badge](/badges/matthiaswilbrink-laravel-feature-toggles/health.svg)

```
[![Health](https://phpackages.com/badges/matthiaswilbrink-laravel-feature-toggles/health.svg)](https://phpackages.com/packages/matthiaswilbrink-laravel-feature-toggles)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)

PHPackages © 2026

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