该包最新版本(v1.5)没有提供许可证信息。

TTG SDK

v1.5 2018-06-05 13:42 UTC

This package is not auto-updated.

Last update: 2024-09-20 21:57:54 UTC


README

一个用于与TTG的API交互的PHP库

使用composer安装

composer require torchlighttechnology/ttg-sdk:"~1.0"

在项目中使用

use torchlighttechnology\TtgSDK;

$api = new TtgSDK(
  'URL', // required
  'USERNAME', // optional
  'PASSWORD' // optional
);

$args = [
  'foo' => 'bar'
];

// your API method must be a dashed route
// calling it here needs to be camelcased
$response = $api->yourExposedApiMethod( // translates to your-exposed-api-method
  json_encode($args), // JSON encoded array
  'POST' // request type of GET, POST, PUT, DELETE
);

示例

在延迟事件中创建新事件

use torchlighttechnology\TtgSDK;

$api = new TtgSDK(
  'http://delayedevents/delayed-events/'
);

// Add custom headers
$api->setHeaders( ['x-api-key: abc1234'] );

$args = [
  $callback_uri,
  $parameters,
  $fire_date
];
$response = $api->create(
  json_encode($args),
  'POST'
);