getsidekicker/flagr-client

Flagr 是一个功能标志、A/B 测试和动态配置的微服务。所有 API 的基本路径为 "/api/v1"。

1.1.14 2023-01-17 00:22 UTC

This package is auto-updated.

Last update: 2024-09-17 04:24:16 UTC


README

Flagr 是一个功能标志、A/B 测试和动态配置的微服务。所有 API 的基本路径为 "/api/v1"。

安装与使用

要求

PHP 7.4 及以上。

Composer

要通过 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/getsidekicker/flagr-client.git"
    }
  ],
  "require": {
    "getsidekicker/flagr-client": "*@dev"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门

请按照安装过程进行操作,然后运行以下命令

<?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()
);
$flag_id = 56; // int | numeric ID of the flag
$segment_id = 56; // int | numeric ID of the segment
$body = new \Flagr\Client\Model\CreateConstraintRequest(); // \Flagr\Client\Model\CreateConstraintRequest | create a constraint

try {
    $result = $apiInstance->createConstraint($flag_id, $segment_id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ConstraintApi->createConstraint: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https:///api/v1

模型

授权

所有端点均不需要授权。