LaravelPackages.net
Acme Inc.
Toggle sidebar
aaronsaray/laravel-simple-feature

Simple feature flag for laravel

107
3
3.0.0
About aaronsaray/laravel-simple-feature

aaronsaray/laravel-simple-feature is a Laravel package for simple feature flag for laravel. It currently has 3 GitHub stars and 107 downloads on Packagist (latest version 3.0.0). Install it with composer require aaronsaray/laravel-simple-feature. Discover more Laravel packages by aaronsaray or browse all Laravel packages to compare alternatives.

Last updated

Laravel Simple Feature Flag

This is a simple feature flag system for Laravel. There are many better, more complex flag systems available. The point of this one is to simply create a light-weight feature flag system that is configured through a facade/helper/service using the config and environment system. Simple!

Installation Instructions

Install via composer in your project. It is recommended to install it into dev.

composer require aaronsaray/laravel-simple-feature

If you're using Laravel 5.5 and above, the service provider will be automatically registered. If not, you'll need to register AaronSaray\LaravelSimpleFeature\Providers\LaravelSimpleFeatureProvider. In addition, you'd need to register the Feature facade.

Publish the config files.

php artisan vendor:publish --tag=config

You can modify the config/laravel-simple-feature.php file for your desired feature flags.

Usage

To use, you can use the following method to get a boolean:

AaronSaray\LaravelSimpleFeature\Facades\Feature::can('your-feature')

You can also use on and off.

You can also inject the service AaronSaray\LaravelSimpleFeature\Services\LaravelSimpleFeatureService if you like.

Finally, you can use a Blade directive as an if statement.

@feature('some-feature')
    <p>This is when the feature is on!</p>
@else
    <p>This is if the feature is off.</p>
@endfeature

Star History Chart