Skip to content

loevgaard/trustpilot-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trustpilot Scraper

A PHP scraper for scraping Trustpilot reviews, trust score and review count

Installation

Add loevgaard/trustpilot-scraper as a dependency in your composer.json file:

composer require loevgaard/trustpilot-scraper

Usage

Create an instance of Loevgaard\Trustpilot\Scraper:

use Loevgaard\Trustpilot\Scraper;

$scraper = new Scraper('www.amazon.com'); // this will scrape https://www.trustpilot.com/review/www.amazon.com

To get all reviews:

foreach($scraper->getReviews() as $review) {
    /** @var \Loevgaard\Trustpilot\Review\Review $review */
    
    var_dump($review);
    var_dump($review->getUser());
}

To get reviews on the first page:

foreach($scraper->getReviews(1) as $review) {
    /** @var \Loevgaard\Trustpilot\Review\Review $review */
    
    var_dump($review);
    var_dump($review->getUser());
}

To get trust score:

$scraper->getTrustScore(); // returns a float between 0 and 10

To get review count:

$scraper->getReviewCount(); // returns an int

License

Trustpilot Scraper is licensed under the MIT license.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages