healthengine / php-flagr
v2.0.0
2022-12-05 03:11 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.3.1 || ^7.0.1 || ^7.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpstan/extension-installer: ^1.2
- phpstan/phpstan: ^1.9
- phpstan/phpstan-strict-rules: ^1.4
Replaces
README
Flagr 是一个功能开关、A/B 测试和动态配置的微服务。所有 API 的基本路径为 /api/v1
。
此 PHP 包由 Swagger Codegen 项目自动生成
- API 版本:
1.1.12
- 构建包:
io.swagger.codegen.v3.generators.php.PhpClientCodegen
要求
- PHP 7.4, 8.0 或 8.1。
安装 & 使用
Composer
要使用 Composer 安装绑定,请在 composer.json
中添加以下内容
composer require healthengine/php-flagr
入门
请按照 安装过程 进行操作,然后运行以下命令
<?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
- Health
- PutDistributionsRequest
- PutFlagRequest
- PutSegmentReorderRequest
- PutSegmentRequest
- PutVariantRequest
- Segment
- SegmentDebugLog
- SetFlagEnabledRequest
- Tag
- Variant
授权文档
所有端点均不需要授权。