mwkcoding / laravel-feature-flags
A simple Laravel package to get feature flags in your project.
Requires
- php: ^8.0
- illuminate/support: ^9.0
- spatie/laravel-sluggable: ^3.3.0
Requires (Dev)
- doctrine/dbal: ^3.1
- nunomaduro/collision: ^6.1
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-12-27 23:36:09 UTC
README
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.