承接 flagr/sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flagr/sdk

最新稳定版本:v0.2.0

Composer 安装命令:

composer require flagr/sdk

包简介

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

README 文档

README

PHP SDK for flagr.dev — evaluate feature flags with a direct API call. No dependencies beyond ext-curl and ext-json.

Install

composer require flagr/sdk

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

Quick start

use Flagr\FlagrClient;

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

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

Usage

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

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 list

Exceptions

Exception When
Flagr\AuthenticationException SDK key rejected (HTTP 401)
Flagr\EvaluationException Network error or unexpected HTTP status

Lifecycle

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

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固