- Notifications
You must be signed in to change notification settings - Fork10
Jaspaul/laravel-rollout
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Laravel package foropensoft/rollout
composer require jaspaul/laravel-rollout
Package discovery will configure the service provider automatically.
php artisan vendor:publish --provider'Jaspaul\LaravelRollout\ServiceProvider'
If you intend to use cache to store the settings for rollout, be sure toenable the cache for your Laravel application. Note if you are using the cache, a cache clear during deployment will cause your rollout settings to be purged. If you require persistence for these settings use the option below.
This will allow you to have rollout settings be persisted even if you clear the application cache for every deployment.
php artisan migrate
ROLLOUT_STORAGE=databaseROLLOUT_TABLE=rollout
Your rollout users must implement the\Jaspaul\LaravelRollout\Contracts\User
interface. Often this will be your main user object:
<?phpuseJaspaul\LaravelRollout\Helpers\UserasContract;class Userimplements Contract{/** * @return string */publicfunctiongetRolloutIdentifier() {return$this->id; }}
Your rollout groups must implement the\Jaspaul\LaravelRollout\Contracts\Group
interface.
<?phpuseJaspaul\LaravelRollout\Contracts\Group;class BetaUsersGroupimplements Group{/** * The name of the group. * * @return string */publicfunctiongetName():string {return'beta-users'; }/** * Defines the rule membership in the group. * * @return boolean */publicfunctionhasMember($user =null):bool {if (!is_null($user)) {return$user->hasOptedIntoBeta(); }returnfalse; }}
and you should update your locallaravel-rollout.php
configuration to include the group in the groups array:
laravel-rollout.php
return [ ...'groups' => [ BetaUsersGroup::class ], ...]
php artisan rollout:add-group {feature} {group}
Swap{feature}
with the name of the feature, and{group}
with the name you defined in the group class.
php artisan rollout:add-user {feature} {user}
Swap{feature}
with the name of the feature, and{user}
with a unique identifier for the user in your system.
php artisan rollout:create {feature}
Swap{feature}
with the name of the feature you'd like to create a feature flag for.
php artisan rollout:deactivate {feature}
Swap{feature}
with the name of the feature you'd like to deactivate globally. Note this will also reset the user whitelist.
php artisan rollout:delete {feature}
Swap{feature}
with the name of the feature you'd like to permanently delete from rollout.
php artisan rollout:everyone {feature}
Swap{feature}
with the name of the feature you'd like to rollout to 100% of your user base.
php artisan rollout:list
php artisan rollout:percentage {feature} {percentage}
Swap{feature}
with the name of the feature you'd like to rollout, and{percentage}
with the percentage of users to rollout the feature to.
php artisan rollout:remove-group {feature} {group}
Swap{feature}
with the name of the feature, and{group}
with the name you defined in the group class.
php artisan rollout:remove-user {feature} {user}
Swap{feature}
with the name of the feature, and{user}
with a unique identifier for the user in your system to remove the feature from.
About
A package to integrate rollout into your Laravel project.