PHPackages                             flagr/sdk - 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. [API Development](/categories/api)
4. /
5. flagr/sdk

ActiveLibrary[API Development](/categories/api)

flagr/sdk
=========

PHP SDK for flagr.dev — evaluate feature flags via direct API call

v0.2.0(3mo ago)03MITPHPPHP &gt;=8.1

Since Mar 22Pushed 3mo agoCompare

[ Source](https://github.com/flagr-dev/sdk-php)[ Packagist](https://packagist.org/packages/flagr/sdk)[ RSS](/packages/flagr-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

flagr-sdk (PHP)
===============

[](#flagr-sdk-php)

PHP SDK for [flagr.dev](https://flagr.dev) — evaluate feature flags with a direct API call. No dependencies beyond ext-curl and ext-json.

Install
-------

[](#install)

```
composer require flagr/sdk
```

Requires PHP 8.1+, ext-curl, ext-json.

Quick start
-----------

[](#quick-start)

```
use Flagr\FlagrClient;

$flagr = new FlagrClient(sdkKey: $_ENV['FLAGR_ENV_KEY']);

if ($flagr->isEnabled('new-checkout', tenantId: $userId)) {
    // show new checkout
}
```

Usage
-----

[](#usage)

### `isEnabled`

[](#isenabled)

```
$enabled = $flagr->isEnabled(
    flagKey:  'new-checkout',
    tenantId: $userId,   // optional, default "" — omit for flags that don't use partial rollout
    default:  false,     // returned if flag is unknown or request fails
);
```

`tenantId` is optional. For `partially_enabled` flags, an empty `tenantId` always returns `false`.

Every call makes a single HTTP POST to `/evaluate`. No local cache, no background connection.

Flag states
-----------

[](#flag-states)

State`isEnabled` result`enabled``true` for every tenant`disabled``false` for every tenant`partially_enabled``true` only if the tenant ID is in the enabled listExceptions
----------

[](#exceptions)

ExceptionWhen`Flagr\AuthenticationException`SDK key rejected (HTTP 401)`Flagr\EvaluationException`Network error or unexpected HTTP statusLifecycle
---------

[](#lifecycle)

The `FlagrClient` reuses a single cURL handle across calls — instantiate once and reuse within a request. The handle is closed automatically on destruction.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance82

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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 ~0 days

Total

4

Last Release

93d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4ec20e9415a26176bbcdc870c60b4a75cd2798a133b396180f5991f060fb411?d=identicon)[perodriguezl](/maintainers/perodriguezl)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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