Switchover is a Software-As-A-Service for managing feature toggles (aka switches, flags or feature flips) in your application. Use it for Continous Integration, Continous Delivery, A/B-Testing, Canary Releases, Experementing and everything else you can think of.
Note: Laravel integration of the Switchover PHP SDK.
Via composer:
composer require switchover/laravel-integration
The SDK-Key (can be found on the switchover environment page) can be specified as env variable in your .env
file:
SWITCHOVER_SDK_KEY=<YOUR SDK KEY>
If you want to change the default cache time of 60 seconds you can also modify this via env variable:
SWITCHOVER_CACHE_TIME=10 # Warning: 0 will cache forever
The package exposes the Switchover
facade to handle your feature toggles in the application.
Example:
class HomeController extends Controller
{
public function index() {
$userCtx = new Context([
'email' => Auth::user()->email;
])
$coolNewFeatures = Switchover::toggleValue('cool-feature', false, $userCtx);
return //...
}
}
You can also publish the underlying config file to get full control over the config e.g. for the Guzzle Http client:
php artisan vendor:publish --tag="switchover-config"
Now, you should have the switchover.config
in your app config folder.
Learn more on the official documentation: Switchover Quickstart