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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

Switchover SDK for PHP

CI codecov CodeFactor

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

PHP Build Version
Package Version
Requires php Version >=7.2
psr/log Version ^1.1
monolog/monolog Version ^2.1
psr/simple-cache Version ^1.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package switchover/php-sdk contains the following files

Loading the files please wait ....