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!
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
In addition, you'd need to register the
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.
To use, you can use the following method to get a boolean:
You can also use
You can also inject the service
AaronSaray\LaravelSimpleFeature\Services\LaravelSimpleFeatureService if you like.
Finally, you can use a Blade directive as an
@feature('some-feature') <p>This is when the feature is on!</p> @else <p>This is if the feature is off.</p> @endfeature