A Feature flag is sometimes also referred to as a feature toggle or feature switch. Ultimately it’s a coding strategy to be used along with source control to make it easier to continuous integrate and continuous deployment. The idea of the flags works by essentially safe guarding sections of code from executing if a feature flag isn’t in a switched on state.
This package aims to make implementing such flags across your application a great deal easier by providing solutions that work with not only your code but your routes, blade files, task scheduling and validations.
This package provides configuration with multiple storage options, and helps you in various contexts:
- Blade Views
- Routing Middleware
- Validation Rules
- Task Scheduling
- Artisan Commands
- Custom PHP logic
With this package you can use the provides
Features facade or service to do things like check if a feature is on or off:
Features::accessible('my-feature') // returns true or false
The same check within a blade template would look like the following:
@feature('my-feature') <p>Your feature flag is turned on. @endfeature @feature('my-feature', false) <p>Your feature flag is turned off. @endfeature
Using the same feature name, you could toggle a route on/off using the provided middleware:
Route::get('/', 'SomeController@get') ->middleware('feature:my-feature');
You can learn more about this package, get full installation instructions, and view the source code on GitHub at ylsideas/feature-flags.
Filed in: News
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
- Laravel Developer
San Jose, CA
- Lead Front End Developer
- Full-Stack Laravel Developer
- Intermediate PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
- Senior PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
- Laravel Developer
Amsterdam (partially remote possible)
- Web Developer (Laravel)
Tweed Heads, New South Wales, AUSTRALIA
Tursa Employment & Training