A Laravel package for handling feature flags
Fund package maintenance!
Installs: 499 786
Open Issues: 0
- php: ^8.0
- illuminate/contracts: 10.*|^9.6
- laravel/pint: ^1.2
- nunomaduro/collision: ^6.0|^5.0
- nunomaduro/larastan: ^2.0|^1.0
- orchestra/testbench: ^8.0|^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpdoc-parser: ^1.15
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5.13
- rector/rector: ^0.14.2
- spatie/laravel-ray: ^1.26
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.
The Feature flagging dashboard for Laravel
In late 2022 we decided to start work on a dashboard that will work on top of all the awesomeness that Feature flags for Laravel gives you. Right now you can join the waiting list.
How adding feature flags looks with this package
It's pretty simple, you can start of with just simple calls to check if a flag's state is on or off.
Features::accessible('my-feature') // returns true or false
One of the unique features of this package is that it integrates heavily into Laravel by allowing you to configure different things such as access to route, schedule tasks or modifying the query builder.
To get a full understanding, it's best to read the docs.
This project is currently at version 2 and is somewhat different to version 1. If you are using Laravel 9 and PHP8 you should aim to use version 2. Version 1 is no longer supported. There is an upgrade guide for moving from version 1 to version 2.
You can install the package via composer:
composer require ylsideas/feature-flags:^2.0
Once installed you should publish the config with the following command.
php artisan vendor:publish --provider="YlsIdeas\FeatureFlags\FeatureFlagsServiceProvider" --tag=config
You can customise the
features.php config in a number of ways.
For the complete documentation, visit https://feature-flags.docs.ylsideas.co/.
If you wish to develop new features for this package you may run the tests using the following command.
Make sure any code you work on is linted as well.
and that the code doesn't introduce errors with PHPStan.
Please make sure you follow the Pull Request template for all proposed changes. Ignoring it will mean the PR will be ignored.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email firstname.lastname@example.org instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.