PHPackages                             ahmadrosid/laravel-env-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ahmadrosid/laravel-env-feature-flags

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

ahmadrosid/laravel-env-feature-flags
====================================

A simple package for managing feature flags in Laravel applications using environment variables.

1.1.2(2y ago)114.1k↓50%2MITPHP

Since Apr 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ahmadrosid/laravel-env-feature-flags)[ Packagist](https://packagist.org/packages/ahmadrosid/laravel-env-feature-flags)[ RSS](/packages/ahmadrosid-laravel-env-feature-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

Laravel Feature Flag
--------------------

[](#laravel-feature-flag)

Sometimes, you need to develop a feature that you want to test in production, but you don't want your users to see it yet. That's where storing feature flags using an environment variable file (`.env`) comes in handy. This package will allow you to do that easily.

Install
-------

[](#install)

```
composer require ahmadrosid/laravel-env-feature-flags
```

How to use
----------

[](#how-to-use)

**1. Define Feature Flags in `.env`**:

In your `.env` file, you can define your feature flags as environment variables. For example:

```
FEATURE_NEW_DESIGN=true
FEATURE_PAYMENT_GATEWAY=false
```

**2. Access Feature Flags in Your Code**:

You can use the Features facade provided by the package to check the status of your feature flags:

```
use Ahmadrosid\FeatureFlags\Features;

if (Features::enabled('new_design')) {
    // Code for the new design feature
} else {
    // Code for the old design
}
```

Note that the enabled method expects a snake\_case string as the feature name, so `FEATURE_NEW_DESIGN` becomes `new_design`.

**3 Add Feature Flag Checks in Blade Templates**:

If you want to conditionally render parts of your Blade templates based on feature flags, you can use the @feature Blade directive provided by the package:

```
@feature('new_design')

@else

@endfeature
```

You can also use Blade directive called `@hasAccess`. This directive can be used in your Blade templates to check if the current user has access to a specific feature. If the user doesn't have access, you can display a message or perform any other action you need.

```
@hasAccess('new_design')

@else

        You don't have access to the new design feature.

@endhasAccess
```

To enable this you need to add this flag in you `.env` file.

```
FEATURE_NEW_DESIGN_USERS=1,2,3
```

LICENSE
-------

[](#license)

MIT

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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 ~0 days

Total

13

Last Release

749d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d81b22a23cd7d401263a7966ae4ee19222b7e65ea4baa68c0d63ee7a4ce1e25?d=identicon)[ahmadrosid](/maintainers/ahmadrosid)

---

Top Contributors

[![ahmadrosid](https://avatars.githubusercontent.com/u/29406408?v=4)](https://github.com/ahmadrosid "ahmadrosid (16 commits)")

### Embed Badge

![Health badge](/badges/ahmadrosid-laravel-env-feature-flags/health.svg)

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

###  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)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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