This is a simple Laravel package for scraping TrustPilot scores and reviews.
You can install the package via composer:
composer require aon2003/laravel-trustpilot
You can publish the config file with:
php artisan vendor:publish --tag="trustpilot-config"
This is the contents of the published config file:
return [
/*
|--------------------------------------------------------------------------
| Default Domain
|--------------------------------------------------------------------------
|
| This is the domain for which the reviews will be scraped by default.
| Supports subdomains.
*/
'domain' => 'www.example.com',
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This is the language in which the reviews will be scraped by default.
|
| Supported values: "all", ISO 639-1 language codes (ex.: "en", "ru")
|
*/
'language' => 'all',
];
$score = LaravelTrustpilot::getScore($domain); // float
$reviews = LaravelTrustpilot::getReviews($domain, $language); // array<stdClass>
If you don't provide a domain and language the values from the config file will be used.
Additionally, there are two commands that can be used for testing purposes.
Description:
Gets the TrustScore of a given domain and outputs it to the console.
Usage:
trustpilot:score [<domain>]
Arguments:
domain The domain for which to get the TrustScore.
Description:
Gets the reviews of a given domain and outputs them to the console.
Usage:
trustpilot:reviews [<domain> [<language>]]
Arguments:
domain The domain for which to get the TrustPilot reviews.
language The language in which to get the TrustPilot reviews.
Please see CHANGELOG for more information on what has changed recently.
If you want to contribute, we would be pleased to see your pull requests.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.