flagception/contentful-activator
Composer 安装命令:
composer require flagception/contentful-activator
包简介
Activator for manage feature toggles by contentful
README 文档
README
Manage feature flags for Flagception with Contentful!
Download the library
Open a command console, enter your project directory and execute the following command to download the latest stable version of this library:
$ composer require flagception/contentful-activator
Usage
Just create a new ContentfulActivator instance and commit it to your feature manager:
// YourClass.php class YourClass { public function run() { // We need two arguments: // 1. A contentful client // 2. The content type name in contentful $activator = new ContentfulActivator($this->client, 'FeatureToggle'); $manager = new FeatureManager($activator); if ($manager->isActive('your_feature_name')) { // do something } } }
The ContentfulActivator need three arguments:
- An instance of a contentful client
- The contentful model type id as string
- The field mappings as array ('name' and 'state') - Optional (default values are set)
If your contentful model looks like this ...
{
"name": "Feature Management",
"description": "Features verwalten",
"displayField": "featureName",
"fields": [
{
"id": "featureName",
"name": "Feature",
"type": "Text",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false
},
{
"id": "isActive",
"name": "Aktiv",
"type": "Boolean",
"localized": false,
"required": true,
"validations": [],
"disabled": false,
"omitted": false
}
],
"sys": {
"space": {
"sys": {
"type": "Link",
"linkType": "Space",
"id": "9d8smn39"
}
},
"id": "myFeatureModel",
"type": "ContentType",
"createdAt": "2017-12-07T15:54:07.255Z",
"updatedAt": "2018-01-11T16:08:47.283Z",
//...
}
}
... then your activator instance should be like this:
// YourClass.php class YourClass { public function run() { // "myFeatureModel" is the content model type $activator = new ContentfulActivator($this->client, 'myFeatureModel', [ 'name' => 'featureName', // Field name for feature key 'state' => 'isActive' // Field name for feature state ]); $manager = new FeatureManager($activator); if ($manager->isActive('your_feature_name')) { // do something } } }
You can skip the field mapping (like the first example) if you use the default field names in contentful:
- 'state' for the feature state field
- 'name' for the feature key field
flagception/contentful-activator 适用场景与选型建议
flagception/contentful-activator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.64k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「contentful」 「flagception」 「contentful-extension」 「activator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 flagception/contentful-activator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flagception/contentful-activator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 flagception/contentful-activator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Feature toggle on steroids.
Feature toggle bundle on steroids.
A Symfony Bundle to integrate the Contentful CDA SDK
Activator for manage feature toggles via database
A client library to integrate with the Contentful APIs (Content Delivery and Content Management) for PHP 5.6+.
A Symfony2 bundle to integrate with the Contentful APIs (Content Delivery and Content Management) for PHP 5.6+.
统计信息
- 总下载量: 1.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-06