承接 regalii/regaliator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

regalii/regaliator

最新稳定版本:1.0.1

Composer 安装命令:

composer require regalii/regaliator

包简介

PHP client library for connecting to the Regalii API

README 文档

README

A PHP client for connecting to the Regalii API.

Usage

After requiring regalii/regaliator in your composer.json file, you can use the class like so:

$configuration = new Regaliator\Configuration([
  'version' => '3.1',
  'api_host' => 'api.casiregalii.com',
  'api_key' => getenv('REGALII_API_KEY'),
  'secret_key' => getenv('REGALII_SECRET')
]);
$regaliator = new Regaliator\Regaliator($configuration);

$response = $regaliator->account();

if ($response->success) {
  $data = json_decode($response->body, true);
} else {
  echo "Failed with status code {$response->status_code}";
}

The $response will be a Response object from the Requests library.

Examples

Examples of some common use-cases:

Creating a credential bill

$response = $regaliator->create_credentials_bill(12376, 'login', 'challengeme');
$bill = json_decode($response->body, true);
echo "Created bill {$bill['id']}\n";

Polling for while bill fetching

function poll_while_updating($regaliator, $id) {
  for($i = 0; $i < 60; $i++) {
    echo "Checking status for bill {$id} after sleeping 1 second\n";
    sleep(1);

    $response = $regaliator->show_bill($id);
    $bill = json_decode($response->body, true);

    if ($bill['status'] !== 'fetching') {
      return $bill;
    }
  }
  // raise exception because bill is still fetching
}

$bill = poll_while_updating($regaliator, $bill['id']);

Answering MFA Challenge

$response = $regaliator->update_bill_mfas($bill['id'], ['mfa_challenges' => [
  [
    'id' => $bill['mfa_challenges'][0]['id'],
    'type' => $bill['mfa_challenges'][0]['type'],
    'response' => '8'
  ]
]]);

统计信息

  • 总下载量: 17.01k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-11-01