PHPackages                             edwinhoksberg/trustpilot-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. edwinhoksberg/trustpilot-api

ActiveLibrary[API Development](/categories/api)

edwinhoksberg/trustpilot-api
============================

An simple library for parsing and displaying Trustpilot reviews.

63014PHP

Since Jan 30Pushed 11y ago2 watchersCompare

[ Source](https://github.com/EdwinHoksberg/trustpilot-api)[ Packagist](https://packagist.org/packages/edwinhoksberg/trustpilot-api)[ RSS](/packages/edwinhoksberg-trustpilot-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Trustpilot API
==============

[](#trustpilot-api)

[![Software License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/111426d369b4debfb4f0eaa9da2259e310f01a6397e6bae300f0d8e86b635c9b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656477696e686f6b73626572672f747275737470696c6f742d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/edwinhoksberg/trustpilot-api)

This library is a simple class for displaying [TrustPilot](http://trustpilot.com) reviews.

Requires a minimum PHP version of 5.4.

How to install
==============

[](#how-to-install)

With composer
-------------

[](#with-composer)

Execute this command in your terminal:

```
composer require edwinhoksberg/trustpilot-api:dev-master

```

Or add this line to your composer.json:

```
"require": {
    "edwinhoksberg/trustpilot-api": "dev-master"
}

```

and run:

```
composer update

```

Without composer
----------------

[](#without-composer)

Add this line add the top of your php application:

```
require 'src/TrustPilot.php';

```

How to use
==========

[](#how-to-use)

```
// Initialize the API
$trustpilot = new \TrustPilot\Api('1234567');
```

```
// Show site total score
$trustpilot->getRatingScore(); // Output: 88
```

```
// Show site stars
$trustpilot->getRatingStars(); // Output: 4
```

```
// Show number of stars for a specific star
$stars = $trustpilot->getReviewStarDistrubution();
echo 'This site has ' . $stars[5] . ' ratings of five stars.';

// Output: This site has 27 ratings of five stars.
```

```
// Dump the data from a random review
var_dump(
    $trustpilot->getRandomReview()
);

// Output:
array(10) {
  ["title"]=>
  string(22) "Very good and excellent prices"
  ["content"]=>
  string(22) "Very good and excellent prices, etc..."
  ["name"]=>
  string(21) "John Doe"
  ["url"]=>
  string(58) "http://www.trustpilot.nl/review/www.mysite.nl#1234567"
  ["language"]=>
  string(5) "en-US"
  ["score"]=>
  int(100)
  ["stars"]=>
  int(5)
  ["score_value"]=>
  string(10) "Excellent"
  ["timestamp"]=>
  int(1418866304)
  ["rating_images"]=>
  array(3) {
    ["small"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/s/5.png"
    ["medium"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/m/5.png"
    ["large"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/l/5.png"
  }
}
```

```
// Display all reviews
var_dump(
    $trustpilot->getAllReviews()
);

// Output:
array(1) {
  [0]=>
  array(10) {
    ["title"]=>
    string(22) "Very good and excellent prices"
    ["content"]=>
    string(22) "Very good and excellent prices, etc..."
    ["name"]=>
    string(21) "John Doe"
    ["url"]=>
    string(58) "http://www.trustpilot.nl/review/www.mysite.nl#1234567"
    ["language"]=>
    string(5) "en-US"
    ["score"]=>
    int(100)
    ["stars"]=>
    int(5)
    ["score_value"]=>
    string(10) "Excellent"
    ["timestamp"]=>
    int(1418866304)
    ["rating_images"]=>
    array(3) {
      ["small"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/s/5.png"
      ["medium"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/m/5.png"
      ["large"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/l/5.png"
    }
  }
  [1]=>
  ...
  [2]=>
  ...
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6866019?v=4)[Edwin Hoksberg](/maintainers/EdwinHoksberg)[@EdwinHoksberg](https://github.com/EdwinHoksberg)

---

Top Contributors

[![EdwinHoksberg](https://avatars.githubusercontent.com/u/6866019?v=4)](https://github.com/EdwinHoksberg "EdwinHoksberg (5 commits)")

### Embed Badge

![Health badge](/badges/edwinhoksberg-trustpilot-api/health.svg)

```
[![Health](https://phpackages.com/badges/edwinhoksberg-trustpilot-api/health.svg)](https://phpackages.com/packages/edwinhoksberg-trustpilot-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k14](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
