PHPackages                             rpiras/laravel-trustpilot - 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. rpiras/laravel-trustpilot

ActiveLibrary[API Development](/categories/api)

rpiras/laravel-trustpilot
=========================

Laravel PHP library for Trustpilot's API

096PHP

Since Oct 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/riccardopiras87/trustpilot)[ Packagist](https://packagist.org/packages/rpiras/laravel-trustpilot)[ RSS](/packages/rpiras-laravel-trustpilot/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (1)Used By (0)

Laravel Trustpilot PHP API
==========================

[](#laravel-trustpilot-php-api)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rpiras/laravel-trustpilot
```

Official Documentation
----------------------

[](#official-documentation)

- [Trustpilot Documentation](https://developers.trustpilot.com/)

Environment Variables
---------------------

[](#environment-variables)

```
TRUSTPILOT_UNIT_ID=
TRUSTPILOT_API_KEY=
TRUSTPILOT_API_SECRET=
TRUSTPILOT_USERNAME=
TRUSTPILOT_PASSWORD=

```

TO-DO
-----

[](#to-do)

- Consumer API
- Consumer Profile API
- Product Reviews API -&gt; Conversations, Invitation Link
- Resources API
- Service Reviews API
- Business Units API (Private Reviews)

Usage
-----

[](#usage)

### Business Unit

[](#business-unit)

```
// Get the first business unit
$businessUnit = Trustpilot::businessUnits()->first();

// Get the 2nd page of business units with 5 per page.
$businessUnits = Trustpilot::businessUnits()
    ->limit(5)
    ->page(2)
    ->get();

// Search for the first business unit with the name 'Trustpilot'
$businessUnit = Trustpilot::businessUnits()
    ->search('Trustpilot')
    ->first();

// Get business unit by id
$businessUnit = Trustpilot::businessUnits()->find('46d6a890000064000500e0c3');

// Get the first business unit's first review
$review = Trustpilot::businessUnits()
    ->first()
    ->reviews()
    ->first();

// Get the logo of the searched business.
$logo = Trustpilot::businessUnits()
    ->search('Trustpilot')
    ->first()
    ->logo();

// Get three of your business reviews ordered by lowest star to highest.
$reviews = Trustpilot::businessUnit()
    ->reviews()
    ->orderBy('stars', 'asc')
    ->limit(3)
    ->get();

// Get one of your business reviews which is one star and has a response.
$review = Trustpilot::businessUnit()
    ->reviews()
    ->where('stars', 1)
    ->where('responded', true)
    ->first();

// Get the review title of 5 of your reviews offseted by 5.
$reviews = Trustpilot::businessUnit()
    ->reviews()
    ->limit(5)
    ->offset(5)
    ->get()
    ->pluck('title');

// Get the the first 10 product reviews of your business that are 4 or 5 stars for the specific products.
$productReviews = Trustpilot::businessUnit()
    ->products()->reviews()
    ->where('sku', [
        'product_1_sku_here',
        'product_2_sku_here',
    ])
    ->where('stars', [4, 5])
    ->limit(10)
    ->get();

// Get the joined product review summary of the two specific products for your business.
$productReviewSummary = Trustpilot::businessUnit()
    ->products()
    ->reviewSummary([
        'product_1_sku_here',
        'product_2_sku_here',
    ]);

// Get the joined product review summary of the two specific products for your business by URL.
$productReviewSummary = Trustpilot::businessUnit()
    ->products()
    ->reviewSummary([], [
        'https://www.example.com/product_1',
        'https://www.example.com/product_2',
    ]);

// Get the aggregated product review summary of the two specific products for your business.
$aggregatedProductReviewSummaries = Trustpilot::businessUnit()
    ->products()
    ->reviewAggregatedSummaries([
        'product_1_sku_here',
        'product_2_sku_here',
    ]);

// Get the batched product review summary of the two specific products for your business.
$productReviewSummaries = Trustpilot::businessUnit()
    ->products()
    ->reviewBatchSummaries([
        'product_1_sku_here',
        'product_2_sku_here',
    ]);

// Get three of your business imported reviews for the given product.
$reviews = Trustpilot::businessUnit()
    ->importedReviews()
    ->where('sku', 'product_sku_here')
    ->limit(3)
    ->get();

// Get five of your business imported reviews for the given products.
$reviews = Trustpilot::businessUnit()
    ->importedReviews()
    ->where('sku', [
        'product_1_sku_here',
        'product_2_sku_here',
    ])
    ->limit(5)
    ->get();

// Get the joined imported product review summary of the two specific products for your business.
$productReviewSummary = Trustpilot::businessUnit()
    ->products()
    ->importedReviewSummary([
        'product_1_sku_here',
        'product_2_sku_here',
    ]);

// Get the joined imported product review summary of the specific product for your business.
$productReviewSummary = Trustpilot::businessUnit()
    ->products()
    ->importedReviewSummary('product_1_sku_here');

// Get the web links of your business.
$webLinks = Trustpilot::businessUnit()->webLinks();

// Get the logo of your business.
$logo = Trustpilot::businessUnit()->logo();

// Get the customer guarantee of your business.
$customerGuarantee = Trustpilot::businessUnit()->customerGuarantee();

// Get the images of your business.
$images = Trustpilot::businessUnit()->images();

// Get the profile of your business.
$profile = Trustpilot::businessUnit()->profile();

// Get the promotion of your business.
$promotion = Trustpilot::businessUnit()->promotion();
```

### Products

[](#products)

```
// Get all products.
$products = Trustpilot::products()->get();

// Get the product with a sku of "samsung-galaxy-s10".
$product = Trustpilot::products()
    ->where('skus', 'samsung-galaxy-s10')
    ->first();

// Get all products with a sku of "samsung-galaxy-s8", "samsung-galaxy-s9" or "samsung-galaxy-s10".
$products = Trustpilot::products()
    ->where('skus', ['samsung-galaxy-s8', 'samsung-galaxy-s9', 'samsung-galaxy-s10'])
    ->get();

// Updating a product.
$product = Trustpilot::products()
    ->where('skus', 'samsung-galaxy-s10')
    ->first();
$product->title = 'Samsung Galaxy S10';
$product->price = '9.99';
$product->currency = 'USD';
$product->save();
```

### Inivitations

[](#inivitations)

```
// Create a service invitation to John Doe from Business Name now.
Trustpilot::businessUnit()->invitation()->service(
    '#123456', 'John Doe', 'john.doe@example.com',
    'no-reply@business.com', 'Business Name'
);

// Create a service invitation to John Doe from Business Name now to be sent
// in 5 days using a custom template id and to redirect to our website afterwards.
Trustpilot::businessUnit()->invitation()->service(
    '#123456', 'John Doe', 'john.doe@example.com',
    'no-reply@business.com', 'Business Name', 'support@business.com',
    \Carbon\Carbon::now()->addDays(5), '507f191e810c19729de860ea',
    'https://example.com/',
);

// Create a product and service invitation from product skus.
Trustpilot::businessUnit()->invitation()->products(
    ['samsung-galaxy-s8', 'samsung-galaxy-s9', 'samsung-galaxy-s10'],
    '#123456', 'John Doe', 'john.doe@example.com',
    'no-reply@business.com', 'Business Name'
);

// Create a product and service invitation from products.
Trustpilot::businessUnit()->invitation()->products(
    [
        new Product([
            'sku' => 'samsung-galaxy-s8',
            'name' => 'Samsung Galaxy S8',
            'brand' => 'Samsung Galaxy',
            'productUrl' => 'https://example.com/products/samsung-galaxy-s8',
            'imageUrl' => 'https://example.com/products/images/samsung-galaxy-s8.jpg',
        ]),
        new Product([
            'sku' => 'samsung-galaxy-s10',
            'name' => 'Samsung Galaxy S10',
            'brand' => 'Samsung Galaxy',
            'productUrl' => 'https://example.com/products/samsung-galaxy-s10',
            'imageUrl' => 'https://example.com/products/images/samsung-galaxy-s10.jpg',
        ]),
    ],
    '#123456', 'John Doe', 'john.doe@example.com',
    'no-reply@business.com', 'Business Name'
);

// Get a list of templates available to be used in invitations.
$templates = Trustpilot::businessUnit()->invitation()->templates();

// Generate a service review invitation link.
$inviteUrl = Trustpilot::businessUnit()->invitation()->generateLink('#123456', 'John Doe', 'john.doe@example.com', 'https://example.com/');

// Delete all invitation data related to the given e-mails.
Trustpilot::businessUnit()->invitation()->deleteByEmails([
    'john.doe@example.com',
    'jane.doe@example.com',
]);

// Delete all invitation data older than 5 years.
Trustpilot::businessUnit()->invitation()->deleteBeforeDate(\Carbon\Carbon::now()->subYears(5));
```

### Categories

[](#categories)

```
// Get all categories.
$categories = Trustpilot::categories()->get();

// Get categories with a parent of "banking_money".
$categories = Trustpilot::categories()
    ->where('parentId', 'banking_money')
    ->get();

// Get category by id.
$category = Trustpilot::categories()->find('trust_bank');

// Get first three business units with the same category as your business unit.
$businessUnits = Trustpilot::businessUnit()->categories()->first()->businessUnits()->limit(3)->get();
```

Credits
-------

[](#credits)

- [McCaulay Hudson](https://github.com/mccaulay)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 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://www.gravatar.com/avatar/11ea9775f90e2599aa7ae65aa60c1365ebdefb56729bf948b7bc71886a2170f7?d=identicon)[Riccardo.Piras](/maintainers/Riccardo.Piras)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/rpiras-laravel-trustpilot/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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