PHPackages                             unleash/client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. unleash/client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

unleash/client
==============

v2.9.284(4mo ago)633.1M—1.8%15[2 issues](https://github.com/Unleash/unleash-php-sdk/issues)8MITPHPPHP ^8.4CI passing

Since Aug 18Pushed 4mo ago4 watchersCompare

[ Source](https://github.com/Unleash/unleash-php-sdk)[ Packagist](https://packagist.org/packages/unleash/client)[ RSS](/packages/unleash-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (19)Versions (298)Used By (8)

Unleash PHP SDK
===============

[](#unleash-php-sdk)

Unleash is a private, secure, and scalable [feature management platform](https://www.getunleash.io/) built to reduce the risk of releasing new features and accelerate software development. This PHP SDK is designed to help you integrate with Unleash and evaluate feature flags inside your application.

You can use this client with [Unleash Enterprise](https://www.getunleash.io/pricing?utm_source=readme&utm_medium=php) or [Unleash Open Source](https://github.com/Unleash/unleash).

[![Tests](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests.yaml/badge.svg)](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests.yaml)[![Tests (8.x)](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests-8.x.yaml/badge.svg)](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests-8.x.yaml)[![Tests (7.x)](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests-7.x.yaml/badge.svg)](https://github.com/Unleash/unleash-php-sdk/actions/workflows/tests-7.x.yaml)[![Coverage Status](https://camo.githubusercontent.com/209d323aa2d31935add413f509eae1246d859b4a8aeafd196b11bde8bb6188d1/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c73436f7665726167652f6769746875622f556e6c656173682f756e6c656173682d7068702d73646b3f6c6162656c3d436f6465253230436f766572616765)](https://coveralls.io/github/Unleash/unleash-php-sdk?branch=main)[![Download](https://camo.githubusercontent.com/909c91717ccadc6f1a3138bc0882ec85bc604ec2125996de265d07c1caa11b69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e6c656173682f636c69656e742e737667)](https://packagist.org/packages/unleash/client)

- [Unleash client SDK](#unleash-client-sdk)
- [Migrating](#migrating)
- [Installation](#installation)
- [Usage](#usage)
    - [Builder](#builder)
        - [Required parameters](#required-parameters)
        - [Optional parameters](#optional-parameters)
        - [Returning intermediate objects](#returning-intermediate-objects)
- [Proxy SDK](#proxy-sdk)
- [Caching](#caching)
- [Bootstrapping](#bootstrapping)
    - [Custom bootstrap provider](#custom-bootstrap-provider)
    - [Disabling communication with Unleash server](#disabling-communication-with-unleash-server)
- [Strategies](#strategies)
    - [Default strategy](#default-strategy)
    - [IP address strategy](#ip-address-strategy)
    - [User ID strategy](#user-id-strategy)
    - [Gradual rollout strategy](#gradual-rollout-strategy)
    - [Hostname strategy](#hostname-strategy)
    - [Context provider](#context-provider)
    - [Custom strategies](#custom-strategies)
- [Variants](#variants)
- [Client registration](#client-registration)
- [Metrics](#metrics)
- [Custom headers via middleware](#custom-headers-via-middleware)
- [Constraints](#constraints)
- [GitLab specifics](#gitlab-specifics)

Unleash client SDK
------------------

[](#unleash-client-sdk)

A PHP implementation of the [Unleash protocol](https://www.getunleash.io/)aka [Feature Flags](https://docs.gitlab.com/ee/operations/feature_flags.html) in GitLab.

You may also be interested in the [Symfony Bundle](https://github.com/Unleash/unleash-client-symfony) for this package.

> Unleash allows you to gradually release your app's feature before doing a full release based on multiple strategies like releasing to only specific users or releasing to a percentage of your user base. Read more in the above linked documentations.

Migrating
---------

[](#migrating)

If you're migrating from 1.x to 2.x, you can read the [migration guide](doc/migrating-1.x-2.x.md).

Installation
------------

[](#installation)

`composer require unleash/client`

Requires PHP 7.2 or newer.

> You will also need some implementation of [PSR-18](https://packagist.org/providers/psr/http-client-implementation)and [PSR-17](https://packagist.org/providers/psr/http-factory-implementation), for example [Guzzle](https://packagist.org/packages/guzzlehttp/guzzle)and [PSR-16](https://packagist.org/providers/psr/simple-cache-implementation), for example [Symfony Cache](https://packagist.org/packages/symfony/cache). Example:

`composer require unleash/client guzzlehttp/guzzle symfony/cache`

or

`composer require unleash/client symfony/http-client nyholm/psr7 symfony/cache`

If you want to make use of events you also need to install `symfony/event-dispatcher`. See [event documentation here](doc/events.md).

Usage
-----

[](#usage)

The basic usage is getting the `Unleash` object and checking for a feature:

```
