Feature Flags for Laravel

Feature Flags for Laravel

The Feature Flags package for Laravel by Peter Fox helps you handle Feature Toggles (aka Feature Flags) in your Laravel applications:

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


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
Remote
continued
Senior Laravel Developer (Full-Stack)
Munich
Volunteer Vision GmbH
Full-Stack Developer
Tampa
Nu Image Medical
Senior Software Developer
Remote (US ONLY)/Kenilworth, NJ
Diversified
Senior Back-end Laravel API Developer - Immediate Contract (Full Time)
Remote
ApproveMe // Document Signing
Web Development Project Manager
Houston, TX
Swyft Filings
Experienced Laravel/VueJS Developer (Freelance)
Remote (preferably in the US)
Prosperly LLC