Download the PHP package retrochaos/trustpilot-authenticator without Composer

On this page you can find all versions of the php package retrochaos/trustpilot-authenticator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package trustpilot-authenticator

Trustpilot Authenticator

A PHP library for obtaining access tokens for the Trustpilot Business User OAuth API.

Originally developed and open-sourced by moneymaxim.

Fully modernised to:

Install

Install via Composer:

The package has no external dependencies other than Symfony’s HTTP client (automatically installed).

Supported OAuth Flows

This library supports all Trustpilot Business OAuth grant types:

Flow Method
Password (legacy, deprecated but still works for old apps) requestPasswordAccessToken()
Client Credentials (server-to-server) requestClientCredentialsAccessToken()
Authorization Code (interactive user login) requestAuthorizationCodeAccessToken()
Refresh Token refreshAccessToken()
Revoke Refresh Token revokeRefreshToken()
Build Authorization URL buildAuthorizationUrl()

Usage

Create the authenticator

1. Password Grant (Deprecated by Trustpilot)

Useful only for older Trustpilot applications pre-February 2025.

The alias getAccessToken() still works for backwards compatibility.

2. Client Credentials Grant (Recommended)

Best for server-to-server integrations.

3. Authorization Code Grant (Interactive User Login)

Step 1 — Redirect the user to login

Step 2 — Exchange the returned code for a real access token

4. Refresh an Access Token

5. Revoke a Refresh Token

6. buildAuthorizationUrl()

buildAuthorizationUrl() constructs a Trustpilot-compatible login URL for the Authorization Code OAuth flow.

Signature

Parameters

Parameter Description
clientId Your Trustpilot API key
redirectUri URL that Trustpilot redirects the user back to
state Optional anti-CSRF or session identifier
scopes Optional list of OAuth scopes as an array of strings

Example

Example output:

What you do with it

Error Handling

All errors throw a single exception type:

AccessToken Object

Every method returns an AccessToken instance:

Tests

A full PHPUnit test harness is included and covers:

Run tests with:

License

MIT License — feel free to use, modify, and contribute.


All versions of trustpilot-authenticator with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
php Version >= 8.2
symfony/http-client Version ^7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package retrochaos/trustpilot-authenticator contains the following files

Loading the files please wait ...