joshkulesza / php-flagr
1.1.13.1
2021-04-16 08:11 UTC
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2 || ^7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ^4.8
README
Flagr 是一个功能标志、A/B 测试和动态配置的微服务。所有 API 的基本路径是 "/api/v1"。
此 PHP 包由 Swagger Codegen 项目自动生成
- API 版本:1.1.12
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen
需求
PHP 5.5 及以上版本
安装和用法
Composer
要通过 Composer 安装绑定,请在 composer.json 中添加以下内容
{
"repositories": [
{
"type": "git",
"url": "https://github.com/joshkulesza/php-flagr.git"
}
],
"require": {
"joshkulesza/php-flagr": "*@dev"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once('/path/to/php-flagr/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照 安装和用法过程 操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new Flagr\Client\Api\ConstraintApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $body = new \Flagr\Client\Model\CreateConstraintRequest(); // \Flagr\Client\Model\CreateConstraintRequest | create a constraint $flag_id = 789; // int | numeric ID of the flag $segment_id = 789; // int | numeric ID of the segment try { $result = $apiInstance->createConstraint($body, $flag_id, $segment_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConstraintApi->createConstraint: ', $e->getMessage(), PHP_EOL; } $apiInstance = new Flagr\Client\Api\ConstraintApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $flag_id = 789; // int | numeric ID of the flag $segment_id = 789; // int | numeric ID of the segment $constraint_id = 789; // int | numeric ID of the constraint try { $apiInstance->deleteConstraint($flag_id, $segment_id, $constraint_id); } catch (Exception $e) { echo 'Exception when calling ConstraintApi->deleteConstraint: ', $e->getMessage(), PHP_EOL; } $apiInstance = new Flagr\Client\Api\ConstraintApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $flag_id = 789; // int | numeric ID of the flag $segment_id = 789; // int | numeric ID of the segment try { $result = $apiInstance->findConstraints($flag_id, $segment_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConstraintApi->findConstraints: ', $e->getMessage(), PHP_EOL; } $apiInstance = new Flagr\Client\Api\ConstraintApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); $body = new \Flagr\Client\Model\CreateConstraintRequest(); // \Flagr\Client\Model\CreateConstraintRequest | create a constraint $flag_id = 789; // int | numeric ID of the flag $segment_id = 789; // int | numeric ID of the segment $constraint_id = 789; // int | numeric ID of the constraint try { $result = $apiInstance->putConstraint($body, $flag_id, $segment_id, $constraint_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConstraintApi->putConstraint: ', $e->getMessage(), PHP_EOL; } ?>
API 端点文档
所有 URI 都是相对于 /api/v1
模型文档
- 约束
- CreateConstraintRequest
- CreateFlagRequest
- CreateSegmentRequest
- CreateTagRequest
- CreateVariantRequest
- 分布
- 错误
- EvalContext
- EvalDebugLog
- EvalResult
- EvaluationBatchRequest
- EvaluationBatchResponse
- EvaluationEntity
- Flag
- FlagSnapshot
- 健康
- PutDistributionsRequest
- PutFlagRequest
- PutSegmentReorderRequest
- PutSegmentRequest
- PutVariantRequest
- Segment
- SegmentDebugLog
- SetFlagEnabledRequest
- Tag
- Variant
授权文档
所有端点都不需要授权。