featuretoggle / lib-php
PHP 库,用于使用功能开关服务
v1.0.1
2016-09-11 20:10 UTC
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: 6.*
- phpfastcache/phpfastcache: ^5.0
This package is not auto-updated.
Last update: 2024-09-28 19:25:57 UTC
README
这是一个用于与 featuretoggle.com 交互的 PHP 客户端库。此库正在积极开发中,可能会频繁更改。欢迎提交错误报告和 pull 请求。
安装
使用 Composer 安装
php composer.phar require featuretoggle/lib-php
使用方法
require 'vendor/autoload.php'; // Create a new FTClient with your customer and environment API key's $featuretoggle = new FeatureToggle\FTClient('customerKey', 'environmentKey', array('options')); // Get features $features = $featuretoggle->getFeatures(); // Check feature status $enabled = $featuretoggle->isEnabled('feature_key'); if($enabled) { // Feature is enabled, do something } else { // Feature is disabled, do something else }
配置选项
该库将 Feature Toggle API 的响应本地缓存,以限制请求数量。默认缓存超时时间为 300 秒(5 分钟)。您可以通过在初始化库时提供 'cache_timeout' 配置选项来调整缓存超时时间。
array( 'cache_timeout' => SECONDS, // optional, defaults to 300 seconds )
贡献
欢迎在 GitHub 上提交错误报告和 pull 请求,链接为 https://github.com/featuretoggle/lib-php。
许可
该库根据 MIT 许可 协议作为开源软件提供。