/laravel-trustpilot

TrustPilot scraper for Laravel applications.

Primary LanguagePHPMIT LicenseMIT

TrustPilot scraper for Laravel applications.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads GitHub Repo stars GitHub forks GitHub

This is a simple Laravel package for scraping TrustPilot scores and reviews.

Support us

Buy Me A Coffee

Installation

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',
];

Usage

$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.

Commands

Additionally, there are two commands that can be used for testing purposes.

trustpilot:score

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.

trustpilot:reviews

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.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

If you want to contribute, we would be pleased to see your pull requests.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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