Download the PHP package switchover/php-sdk without Composer
On this page you can find all versions of the php package switchover/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download switchover/php-sdk
More information about switchover/php-sdk
Files in switchover/php-sdk
Package php-sdk
Short Description Switchover PHP SDK. Feature Toggle Management made easy!
License MIT
Informations about the package php-sdk
Switchover SDK for PHP
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: Use this SDK for PHP Projects
Getting Started
Install
Via composer:
For Laravel Users
Use our Laravel Package to get up and running quickly with Switchover in your Laravel App: https://github.com/switchover-io/laravel-integration
Initialize client
You will find your SDK Key on the environment page. Copy it and use it to initialize the client:
Basic usage:
What is the Context
?
The context holds any data (key-value pair) which should be evaluated against the toggle conditions. This can be anything, from user-related data (email, userId) to pure technical infos (stage, system infos, versions, etc). If you have rollout options you have to provide a uuid (more details below).
:eyes: PLEASE NOTE We do not send any context data (and such any user data) to our servers. All evaluations happens on the client.
In an user webfrontend you would typically want to use userdata like email or userId, etc. to evaluate you feature flag. Of course the toggle conditions should also contain the relevant context key.
Example:
If you have specified a rollout option for you feature flag it is important to provide a UUID. You can freely choose, but should be unique.
Example:
:warning: IMPORTANT: Rollout options expects a uuid. Toggle evaluation will fail and return the default value if you don't provide the uuid.
Client Options
It's possible to pass numerous options to the client:
Option | Value |
---|---|
cache.time |
Sets time in seconds before the internal cache becomes stale and will be refreshed (TTL). Default is 60 seconds. The value 0 will keep the cache forever. |
logger |
Possibility to provide you own logger instance (PSR-7). |
cache |
Option to set your cache instance (e.g. for redis). Expects a PSR-16 compliant instance. |
http |
The client uses guzzlehttp/guzzle for http requests. You can pass an array of options to the Guzzle Http Client. |
Example
Documentation
Learn more on the official documentation: Switchover Quickstart
All versions of php-sdk with dependencies
psr/log Version ^1.1
monolog/monolog Version ^2.1
psr/simple-cache Version ^1.0
guzzlehttp/guzzle Version ^7.0