itspirit/trustpilot-invitation-api

A PHP library for accessing the Trustpilot Invitation API and fetching recieved Product reviews

Installs: 1 853

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 10

Type:project

2.0.0 2017-10-08 09:31 UTC

This package is auto-updated.

Last update: 2024-03-29 02:19:38 UTC


README

Latest Stable Version Total Downloads License composer.lock available

A PHP library for accessing the Trustpilot Invitation API.

Install

Install using composer:

composer install itspirit/trustpilot-invitation-api

Usage Invitation

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($apiKey, $apiToken, $username, $password);
$accessToken = $authenticator->getAccessToken();

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

Usage fetch Product reviews

use Trustpilot\Api\Authenticator\Authenticator;
use Trustpilot\Api\Invitation\Client;

$authenticator = new Authenticator($apiKey, $apiToken, $username, $password);
$accessToken = $authenticator->getAccessToken();

$client = new Client($accessToken);

$reviews = $client->getProductReviews(TRUSTPILOT_BUSINESS_UNIT_ID, null,
                ['published', 'unpublished', 'underModeration', 'archived'], 'de', $page, 100)