Skip to content

Laravel Integration for Switchover PHP SDK. Feature Toggle Management made easy.

License

Notifications You must be signed in to change notification settings

switchover-io/laravel-integration

Repository files navigation

Switchover Laravel Integration

CI codecov

Switchover

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.

Getting Started

Install

Via composer:

composer require switchover/laravel-integration

Configuration

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

Basic Usage

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 //...
    }
}

Advanced Configuration

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.

Documentation

Learn more on the official documentation: Switchover Quickstart

About

Laravel Integration for Switchover PHP SDK. Feature Toggle Management made easy.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages