open-feature/flagd-provider
Composer 安装命令:
composer require open-feature/flagd-provider
包简介
The Flagd provider package for open-feature
README 文档
README
Overview
Flagd is a simple command line tool for fetching and presenting feature flags to services. It is designed to conform to OpenFeature schema for flag definitions. This repository and package provides the client side code for interacting with it via the OpenFeature PHP SDK.
This package also builds on various PSRs (PHP Standards Recommendations) such as the Logger interfaces (PSR-3) and the Basic and Extended Coding Standards (PSR-1 and PSR-12).
Installation
composer require open-feature/flagd-provider
Usage
The FlagdProvider client constructor takes a single optional argument with 3 fields, their default values correspond to the default arguments supplied to the flagd server:
/** @var \Psr\Http\Client\ClientInterface $client */ $client; /** @var Psr\Http\Message\RequestFactoryInterface $requestFactory */ $requestFactory; /** @var Psr\Http\Message\StreamFactoryInterface $streamFactory */ $streamFactory; OpenFeatureAPI::setProvider(new FlagdProvider([ 'protocol' => 'http', 'host' => 'localhost', 'port' => 8013, 'secure' => true, 'http' => [ 'client' => $client, 'requestFactory' => $requestFactory, 'streamFactory' => $streamFactory, ], ]));
- protocol: "http" (defaults to http)
- host: string (defaults to "localhost")
- port: number (defaults to 8013)
- secure: true | false (defaults to false)
- http: An array or
HttpConfigobject, providing implementations for PSR interfaces- client: a
ClientInterfaceimplementation - requestFactory: a
RequestFactoryInterfaceimplementation - streamFactory: a
StreamFactoryInterfaceimplementation
- client: a
gRPC vs HTTP
The Flagd server is gRPC but offers gRPC Web endpoints that can be accessed over HTTP. The latter is used by the current implementation of the Flagd provider, with future development planned to implement a gRPC native provider option. There are certain flexibilities around HTTP with PHP available, whereas gRPC is an opinionated code-generation strategy, but they are both useful and gRPC native may provide better performance over certain sync/async scenarios. An additional goal will be to provide benchmarking of the Flagd provider's protocol for various scenarios so this decision can be made more easily by consumers of the provider.
Development
PHP Versioning
This library targets PHP version and newer. As long as you have any compatible version of PHP on your system you should be able to utilize the OpenFeature SDK.
This package also has a .tool-versions file for use with PHP version managers like asdf.
Installation and Dependencies
Install dependencies with composer install. composer install will update the composer.lock with the most recent compatible versions.
We value having as few runtime dependencies as possible. The addition of any dependencies requires careful consideration and review.
Testing
Run tests with composer run test.
open-feature/flagd-provider 适用场景与选型建议
open-feature/flagd-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 152.2k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 11 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「provider」 「featureflags」 「featureflagging」 「openfeature」 「flagd」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 open-feature/flagd-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 open-feature/flagd-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 open-feature/flagd-provider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP implementation of the OpenFeature SDK
Time provider, providing consistent current date, time, datetime and timezone across the request.
An Zend Expressive module for loading ZF2 or ZF3 modules.
The Split provider package for OpenFeature
A fast and intuitive dependency injection container.
The Datadog dd-trace hook package for OpenFeature
统计信息
- 总下载量: 152.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-11-08