mwkcoding/laravel-feature-flags

A simple Laravel package to get feature flags in your project.

0.1.1 2022-08-27 17:43 UTC

This package is auto-updated.

Last update: 2024-05-27 22:23:04 UTC


README

GitHub Actions GitHub commits since latest release (by SemVer) Latest Version on Packagist Total Downloads Packagist PHP Version Support codecov

A Feature flag is at times 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 continuously integrate and deploy. 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.

Installation

You can install the package via composer:

composer require mwkcoding/feature-flags

Publish the config:

php artisan vendor:publish --provider="Mwk\FeatureFlags\FeatureFlagsServiceProvider" --tag="config"

Usage

In your controllers, jobs, etc.

// Check if a feature is enabled in your backend logic
use Mwk\FeatureFlags\FeatureManagerFacade;

if (FeatureManagerFacade::feature('my-feature')->enabled()) {
    // Your feature specific logic
}

Blade views

@feature('my-feature')
    <p>Feature turned on</p>
@endfeature

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email mikkel@mwkcoding.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.