smart-contact/trustpilot-api-service

PHP API Service for Trustpilot

v1.2.1 2024-01-10 16:39 UTC

This package is auto-updated.

Last update: 2024-11-10 18:38:01 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

PHP Service class for trustpilot APIs.

Installation

You can install the package via composer:

composer require smart-contact/trustpilot-api-service

Usage

To use this class you have to pass this information: business unit ID, API KEY, API Secret, your username and password.

All the available methods try to follow the same name as the API documentation. All 'GET' requests, accept a param as query params and use the same keys as documentation. All 'POST' requests, accept 2 params, data and options(optional), same as query params, all keys are equal to the documentation.

use SmartContact/TrustpilotApiService/TrustpilotApiService;

$trustpilotService = new TrustpilotApiService();

$trustpilotService->init([
  'business_unit_id' => '123456789',
  'api_key' => 'abcdefghijklmnopqrstuvwxyz',
  'api_secret' => '123456789abcdefghi',
  'username' => 'user@trustpilot.com',
  'password' => 'P4ssw0rd'
]);

//authenticate to get a valid token
$trustpilotService->authenticate(); // if you use the same instance, once you have authenticated the service will automatically refresh the token when it is expired

//get invitation templates
$data = $trustpilotService->getInvitationTemplates();

var_dump($data['templates']);

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate by Beyond Code.