Skip to content

moneymaxim/TrustpilotInvitationApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trustpilot Invitation API Client

Latest Stable Version Total Downloads License

A PHP library for accessing the Trustpilot Invitation API.

This library has been developed and open sourced by moneymaxim.

We are currently on the look out for PHP programming talent, so please get in touch if you are interested.

Install

Install using composer:

composer install moneymaxim/trustpilot-invitation-api

Usage

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 */