简化 / 雨林认证
Rainforest QA 的 rainforestapp/auth Ruby 钥匙的 PHP 端口 - 允许使用您的私有 API 密钥验证 Rainforest webhook 消息。
1.0
2019-01-10 14:52 UTC
Requires
- php: >=7.0
- ext-json: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-18 03:04:14 UTC
README
Rainforest QA 的 Ruby auth 钥匙的简单 PHP 端口,允许使用您的私有 API 密钥验证 Rainforest webhook 消息。
安装
运行 composer require simplicate/rainforest-auth
或手动将其添加到 composer.json
{
"require": {
"simplicate/rainforest-auth": "^1.0"
}
}
API 密钥
API 密钥可以在 账户设置页面 下找到。 请注意:使用的令牌必须是账户所有者的令牌!
示例
检查签名是否有效
$apiKey = 'abc'; // Should be safe data from the $_POST var $post = [ 'digest' => 'abc', 'callback_type' => 'before_run', 'options' => [ 'run_id' => 123123, ], ]; $auther = new \Simplicate\Rainforest\Auther($apiKey); if(!$auther->verify($digest, $callbackType, $options)) { throw new \Exception('Could not verify that the request came from Rainforest'); } // Everything's all right! Do your housekeeping.
如果您有一个将耗时超过 25 秒的任务,Rainforest 建议 您立即响应 202 已接受,并在准备好让 Rainforest 继续时发送 POST 请求
// Same payload as before $callbackUrl = $auther->getCallbackUrl($post['options']['run_id'], $post['callback_type']); // Make a POST request to this URL through php-curl, or your preferred HTTP client
许可证
MIT 许可证。
版权
版权(c)2018 Simplicate Software B.V.