PHPackages                             featurit/featurit-sdk-php - 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. featurit/featurit-sdk-php

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

featurit/featurit-sdk-php
=========================

PHP SDK for FeaturIT

v1.0.1(1y ago)31.6k2MITPHPPHP ^8.0.2

Since Nov 25Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (18)Versions (18)Used By (2)

FeaturIT SDK for PHP
====================

[](#featurit-sdk-for-php)

[![Build Status](https://camo.githubusercontent.com/d9a95b416b2631ef2b052460fe5044fa9fa3d158ecddd11a25a6b6559e52fdb8/68747470733a2f2f7472617669732d63692e6f72672f66656174757269742f66656174757269742d73646b2d7068702e737667)](https://travis-ci.org/laravel/framework)[![Total Downloads](https://camo.githubusercontent.com/bcc3224131ba77a7007459094bd15032d5b3afd045fac3d05cf511e268df1941/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66656174757269742f66656174757269742d73646b2d706870)](https://packagist.org/packages/featurit/featurit-sdk-php)[![Latest Stable Version](https://camo.githubusercontent.com/ab18c3ed6423e7cf681c26fd1e3c925d51ac698519b353d09752318ff65ba3f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66656174757269742f66656174757269742d73646b2d706870)](https://packagist.org/packages/featurit/featurit-sdk-php)[![License](https://camo.githubusercontent.com/26382c232282e0b946d60d2b59da53c9ecd6ef016e1942c3cf7d7ccf8f12dd90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66656174757269742f66656174757269742d73646b2d706870)](https://packagist.org/packages/featurit/featurit-sdk-php)

PHP client for the FeaturIT Feature Flag management platform.

Description
-----------

[](#description)

This package aims to simplify the integration of the FeaturIT API in a PHP project.

Getting started
---------------

[](#getting-started)

### Dependencies

[](#dependencies)

- PHP &gt;= 8.0
- psr/http-client-implementation
- psr/simple-cache-implementation

### Installing

[](#installing)

`composer require featurit/featurit-sdk-php`

If there's no package providing psr/http-client-implementation, visit  and choose the package that better suits your project.

If there's no package providing psr/simple-cache-implementation, visit  and choose the package that better suits your project.

### Basic Usage

[](#basic-usage)

```
$featurit = new \Featurit\Client\Featurit(
    'my-tenant-subdomain',
    'my-environment-key'
);

$isFeatureFlagActive = $featurit->isActive('MY_FEATURE_NAME');

if ($isFeatureFlagActive) {
    my_feature_code();
}

```

### Segmentation Usage

[](#segmentation-usage)

This is useful when you want to show different versions of your features to your users depending on certain attributes.

```
$featurit = new \Featurit\Client\Featurit(
    'my-tenant-subdomain',
    'my-environment-key'
);

$userContext = new \Featurit\Client\Modules\Segmentation\DefaultFeaturitUserContext(
    '1234',
    '123af503',
    '192.168.1.1',
    [
        'role' => 'ADMIN',
        'email' => 'featurit.tech@gmail.com',
    ]
);

$featurit->setUserContext($userContext);

$isFeatureFlagActive = $featurit->isActive('MY_FEATURE_NAME');

if ($isFeatureFlagActive) {
    $featureVersion = $featurit->version('MY_FEATURE_NAME');

    if ($featureVersion == 'v1') {
        my_feature_v1_code();
    } else if ($featureVersion == 'v2') {
        my_feature_v2_code();
    }
}

```

### Creating a UserContextProvider

[](#creating-a-usercontextprovider)

In some cases you want to fill the UserContext data once and forget about it when checking for feature flags.

If that is your case you can implement your own UserContextProvider and pass it to the Featurit client constructor (we recommend using our builder in order to create a new Featurit client).

```
class MyFeaturitUserContextProvider implements FeaturitUserContextProvider

    public function getContext(): FeaturitUserContext
    {
        $contextData = get_my_context_data();

        return new DefaultFeaturitUserContext(
            $contextData['userId'],
            $contextData['sessionId'],
            $contextData['ipAddress'],
            [
                'role' => $contextData['role'],
                ...
            ]
        );
    }
}

```

### Event Tracking

[](#event-tracking)

In order to track some event in your application, you can add this once the event has happened:

```
$featurit = new \Featurit\Client\Featurit(
    'my-tenant-subdomain',
    'my-environment-key'
);

$userContext = new \Featurit\Client\Modules\Segmentation\DefaultFeaturitUserContext(
    '1234',
    '123af503',
    '192.168.1.1',
    [
        'role' => 'ADMIN',
        'email' => 'featurit.tech@gmail.com',
    ]
);

$featurit->setUserContext($userContext);

$featurit->trackPerson();

// trackPerson will track a new Person with the data set in the FeaturitUserContext.

$featurit->track('MY_EVENT_NAME', [
    'a_property_name' => 'a_property_value',
    'another_property_name' => 'another_property_value',
]);

```

All the events and people you track in the same request will be accumulated and associated to the current FeaturitUserContext, if for some reason you want to send the data immediately, you can do as follows:

```
$featurit->flush();

```

### Authors

[](#authors)

FeaturIT

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance44

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~49 days

Recently: every ~6 days

Total

17

Last Release

475d ago

Major Versions

v0.9.2 → v1.0.02025-01-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/4895ead04684ec23e0f8b55eace7ccf2cb6f68b81cdc0cf7a2441cec6cf414a3?d=identicon)[sudobat](/maintainers/sudobat)

---

Top Contributors

[![sudobat](https://avatars.githubusercontent.com/u/6544122?v=4)](https://github.com/sudobat "sudobat (19 commits)")

---

Tags

featurefeature togglea b testingfeature flaguser targetingfeaturitfeature management

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/featurit-featurit-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/featurit-featurit-sdk-php/health.svg)](https://phpackages.com/packages/featurit-featurit-sdk-php)
```

###  Alternatives

[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M64](/packages/opensearch-project-opensearch-php)[shopware/app-php-sdk

Shopware App SDK for PHP

1577.8k1](/packages/shopware-app-php-sdk)[unleash/client

633.1M8](/packages/unleash-client)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
