PHPackages                             mohamedahmed01/feature-flag - 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. mohamedahmed01/feature-flag

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

mohamedahmed01/feature-flag
===========================

easily switch on and off features using a simple command

v1.0.2(3y ago)3105MITPHPPHP ^7.4|^8.0

Since Mar 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mohamedahmed01/feature-flag)[ Packagist](https://packagist.org/packages/mohamedahmed01/feature-flag)[ Docs](https://github.com/mohamedahmed01/feature-flag)[ RSS](/packages/mohamedahmed01-feature-flag/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

[![Feature Flag](logo.png)](logo.png)

 [![Build Status](https://github.com/mohamedahmed01/feature-flag/actions/workflows/main.yml/badge.svg)](https://github.com/mohamedahmed01/feature-flag/actions) [![Latest Stable Version](https://camo.githubusercontent.com/d89dfd05ad52090c8e07ebafeb040ad6de59b8852f8b4dc7bf9116eff757d740/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68616d656461686d656430312f666561747572652d666c6167)](https://packagist.org/packages/mohamedahmed01/feature-flag) [![License](https://camo.githubusercontent.com/64967f51c6692b00add4cb7691a4a53112d68d87dea96d1081705efe9289cf73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f68616d656461686d656430312f666561747572652d666c6167)](https://packagist.org/packages/mohamedahmed01/feature-flag)

Introduction
------------

[](#introduction)

**Feature Flag** is the easiest way to enable and disable features on your different **Laravel** enviroments it also enable you to do A/B testing and supporting your **users** with **different** features sets.

Installtion
-----------

[](#installtion)

- Adding the package using composer

```
    composer require mohamedahmed01/feature-flag
```

- publishing configuration

```
    php artisan vendor:publish --provider="Mohamedahmed01\FeatureFlag\FeatureFlagServiceProvider" --tag="config"
```

- Facade is automatically loaded using composer unless you have laravel version &lt; 5.4 you will need to add the facade manually in config/app.php

```
   'FeatureFlag'=> Mohamedahmed01\FeatureFlag\FeatureFlagFacade::class
```

Usage
-----

[](#usage)

```
    //Feature Flagging can be simple done by creating the flag
    $featureFlag = new FeatureFlag([
            'name' => 'test',
            'description' => 'Test feature flag',
        ]);
    $featureFlag->save();

    //using the flag to scope your your code using if condition or any other way you like
    if ($featureFlag->isEnabled()) {
        // Implement the feature for the user
    }

    //or you can use the method Targted and checking the audience to match to specific audience
    if($featureFlag->isTargeted() && in_array($user->id, $featureFlag->getAudience())) {
        // Implement the feature for the user
    }

    //Feature Flagging can be also used to target users based on percentage
    $featureFlag = new FeatureFlag([
            'name' => 'test',
            'description' => 'Test feature flag',
            'percentage'=>50
        ]);
    $featureFlag->save();
    // you can use the method isEnabledForUser and checking the audience to match to specific audience i.e 50%
    if($featureFlag->isEnabledForUser($user)) {
        // Implement the feature for the user
    }
    //Feature Flagging can be also used to flag based on datetime
    $featureFlag = new FeatureFlag([
            'name' => 'test flag',
            'finish_date' => '01/04/2023',
            'enabled' => true,
        ]);
    $featureFlag->save();
    // you can use the env either to throw an exception or send a notification when flag expires
    if($featureFlag->isEnabled()) {
        // Implement the feature for the user
    }
    //then simply call feature-flag:manage followed by the name of your flag to enable Or disable it
    php artisan feature-flag:manage {flag : The name of the feature flag}
    {--enable : Enable the feature flag} {--disable : Disable the feature flag}
```

### Configuration :

[](#configuration-)

Config NameDescriptionFEATURE\_FLAG\_DRIVERAllow you to change the backend driver currently support eleqountFEATURE\_FLAG\_FINISH\_DATE\_ACTIONChoose What to do when a date based feature flag expires options "exception,notification"FEATURE\_FLAG\_NOTIFICATION\_EMAILset the email to receive on notifications in case you used notification option### Methods :

[](#methods-)

MethodDescriptiongetName()getthe name of the flaggetDescription()get the description of the flagsetEnabled(bool)enable the flag or disable it depending on the valueisEnabled()check if the flag is enabled or notTargted()check if the flag has specific audiencesetAudience(array)set the flag audience by sending array of user's id's i.e \[1,2,3,4\]getAudience()get the audience id's of the users for this flagisEnabledForUser($user)check random user for falling within the percentageContributing
------------

[](#contributing)

Thank you for considering contributing to Feature-Flag! You can read the contribution guide [here](.github/CONTRIBUTING.md).

### Testing

[](#testing)

```
composer test
```

### Security

[](#security)

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

License
-------

[](#license)

Feature-Flag is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Every ~16 days

Total

3

Last Release

1113d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/544700fcf45f5d03e02923ac2e9009264b0f8cafa12438135253da15e5e12fbb?d=identicon)[mohamedahmed01](/maintainers/mohamedahmed01)

---

Top Contributors

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

---

Tags

feature flagmohamedahmed01

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mohamedahmed01-feature-flag/health.svg)

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

###  Alternatives

[symfony/ux-chartjs

Chart.js integration for Symfony

1003.2M18](/packages/symfony-ux-chartjs)[arokettu/composer-license-manager

License management plugin for Composer

61207.9k](/packages/arokettu-composer-license-manager)[remotelyliving/doorkeeper

A Feature Toggle

1636.9k](/packages/remotelyliving-doorkeeper)

PHPackages © 2026

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