retrochaos/trustpilot-invitation-api

A PHP library for accessing the Trustpilot Invitation API

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 10

pkg:composer/retrochaos/trustpilot-invitation-api

2.0.0 2025-11-18 17:12 UTC

This package is auto-updated.

Last update: 2025-12-18 17:17:53 UTC


README

A PHP library for accessing the Trustpilot Invitation API.

Originally developed and open-sourced by moneymaxim.

Fully modernised to:

  • Use Symfony HTTP Client
  • Provide type-safe error handling

Install

Install using Composer:

composer install retrochaos/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 */