retrochaos / trustpilot-invitation-api
用于访问Trustpilot邀请API的PHP库
1.0.0
2024-02-20 11:30 UTC
Requires
- php: ^7.4 | ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^6.0 | ^7.0
- retrochaos/trustpilot-authenticator: ^1.0
This package is auto-updated.
Last update: 2024-09-20 12:53:51 UTC
README
这是一个用于访问Trustpilot邀请API的PHP库。
这个库最初由moneymaxim开发和开源。
后来被分支并更新以使用Guzzle7
安装
使用 composer 安装
composer install retrochaos/trustpilot-invitation-api
用法
use Trustpilot\Api\Authenticator\Authenticator; use Trustpilot\Api\Invitation\Client; use Trustpilot\Api\Invitation\Recipient; use Trustpilot\Api\Invitation\Sender; use Trustpilot\Api\Invitation\Context; $authenticator = new Authenticator(); $accessToken = $authenticator->getAccessToken($apiKey, $apiToken, $username, $password); $client = new Client($accessToken); $context = new Context($businessUnitId, $templateId, $redirectUri); // The last two arguments to the Context constructor ($tags and $locale) are optional // $context = new Context($templateId, $redirectUri, $tags = array(), $locale = 'en-US'); $recipient = new Recipient($recipientEmail, $recipientName); $sender = new Sender($senderEmail, $senderName, $replyTo); $client->invite($context, $recipient, $sender, $reference) /* : array */