Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2024-06-17 (2 days ago) | | Not yet rated by the users | | Total: Not yet counted | | Not yet ranked |
|
Description | | Author |
This package can enable and disable features of the Laravel application.
It provides a class to store the details of features of a Laravel application, such as the feature name, description, users that have the feature enabled, period of availability of the feature, etc...
The class can check if a given feature is currently enabled.
Features can be enabled and disabled with Artisan. | |
|
|
Innovation award
Nominee: 1x |
|
Instructions
Usage
//Feature Flagging can be simple done by creating the flag
$featureFlag = new FeatureFlag([
'name' => 'test',
'description' => 'Test feature flag',
]);
$featureFlag->save();
//using the flag to scope your your code using if condition or any other way you like
if ($featureFlag->isEnabled()) {
// Implement the feature for the user
}
//or you can use the method Targted and checking the audience to match to specific audience
if($featureFlag->isTargeted() && in_array($user->id, $featureFlag->getAudience())) {
// Implement the feature for the user
}
//Feature Flagging can be also used to target users based on percentage
$featureFlag = new FeatureFlag([
'name' => 'test',
'description' => 'Test feature flag',
'percentage'=>50
]);
$featureFlag->save();
// you can use the method isEnabledForUser and checking the audience to match to specific audience i.e 50%
if($featureFlag->isEnabledForUser($user)) {
// Implement the feature for the user
}
//Feature Flagging can be also used to flag based on datetime
$featureFlag = new FeatureFlag([
'name' => 'test flag',
'finish_date' => '01/04/2023',
'enabled' => true,
]);
$featureFlag->save();
// you can use the env either to throw an exception or send a notification when flag expires
if($featureFlag->isEnabled()) {
// Implement the feature for the user
}
//then simply call feature-flag:manage followed by the name of your flag to enable Or disable it
php artisan feature-flag:manage {flag : The name of the feature flag}
{--enable : Enable the feature flag} {--disable : Disable the feature flag}
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.