PHPackages                             jonathanbird/feature-switch - 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. jonathanbird/feature-switch

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

jonathanbird/feature-switch
===========================

Feature switching made easy

0.1.0(10y ago)2634.5k↓69.1%6[1 issues](https://github.com/jonathan-bird/feature-switch/issues)MITPHP

Since Jun 8Pushed 10y ago2 watchersCompare

[ Source](https://github.com/jonathan-bird/feature-switch)[ Packagist](https://packagist.org/packages/jonathanbird/feature-switch)[ RSS](/packages/jonathanbird-feature-switch/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Feature Switching (made easy) for Laravel
=========================================

[](#feature-switching-made-easy-for-laravel)

Need to wrap new features for dev and production? Use a directive in the view or alias in the controller

There's great libraries in Java and other languages, but I found a real lack of good libraries to do this in PHP, so I've created my own.

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

[](#installation)

Add the following line to the `require` section of `composer.json`:

```
{
    "require": {
        "jonathanbird/feature-switch": "dev-master"
    }
}
```

or `composer require jonathanbird/feature-switch`

Setup
-----

[](#setup)

1. Add `'JonathanBird\FeatureSwitch\FeatureSwitchServiceProvider',` to the service provider list in `app/config/app.php`.
2. Run `php artisan vendor:publish` to publish the features config file to `config/feature-switch/features.php`

Usage
-----

[](#usage)

1. In the view, you can use the directive `@feature('feature_name') something @endfeature` (note `@else` also works for when a feature is not enabled)
2. In your controller or anywhere, simply add `use Feature;` to the top of your file and use the alias `Feature::isEnabled('feature_one')` which returns a boolean value
3. To add features, add your feature name and boolean value to `config/feature-switch/features.php`

Why would I use this over git merging?
--------------------------------------

[](#why-would-i-use-this-over-git-merging)

If you have multiple environments (e.g. three test environments, staging and production) and you want to have the code base in a state of continuous deployment, then you may wish to branch your feature, wrap it within feature switch, merge it in to master branch, and when it gets to staging or production and you realise there's a bug, you can simply switch the feature off without it causing an issue rather than having to remove code from a merge. This is also works well for launching a feature as it's a simple on/off switch - simply git ignore the features.php file to have a different one in each environment.

Issues
------

[](#issues)

If you find an issue, please report it. If it's something you can fix, fork the project and use a pull request as it'll be much quicker.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

3677d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2495213?v=4)[jonathanbird](/maintainers/jonathanbird)[@jonathanbird](https://github.com/jonathanbird)

---

Top Contributors

[![jonathan-bird](https://avatars.githubusercontent.com/u/1510001?v=4)](https://github.com/jonathan-bird "jonathan-bird (12 commits)")[![Petah](https://avatars.githubusercontent.com/u/134799?v=4)](https://github.com/Petah "Petah (1 commits)")

### Embed Badge

![Health badge](/badges/jonathanbird-feature-switch/health.svg)

```
[![Health](https://phpackages.com/badges/jonathanbird-feature-switch/health.svg)](https://phpackages.com/packages/jonathanbird-feature-switch)
```

###  Alternatives

[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2553.0M24](/packages/stfalcon-tinymce-bundle)[reinink/remember-query-strings

Laravel middleware that automatically remembers and restores query strings.

76660.1k3](/packages/reinink-remember-query-strings)[ademarre/binary-to-text-php

Collection of binary-to-text encoding utilities for PHP. Includes Base32 support and much more.

39172.5k](/packages/ademarre-binary-to-text-php)[diarmuidie/niceid

PHP library to generate short, non-sequential, URL-friendly hashes of incremental IDs. Similar to YouTube (https://www.youtube.com/watch?v=dQw4w9WgXcQ) and Bitly (http://bit.ly/1D0CAzd) URLs.

1557.9k](/packages/diarmuidie-niceid)[corneltek/formkit

242.9k2](/packages/corneltek-formkit)[wdev-rs/laravel-analytics

Collect page view data in your application without third party tracking

151.2k](/packages/wdev-rs-laravel-analytics)

PHPackages © 2026

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