PHP Laravel 7.x and 6.x - Website Scraper using Goutte

May 25, 2018 | Category : Laravel 5.6 Laravel 5.5 Laravel PHP

In this tutorial, i will let you know how to website scraping in laravel application using Goutte package. i will explain step by step tutorial for web data scraping in laravel 5.6 application.

Web scraping, also known as data mining, web harvesting, web data extraction, or screen scraping is a technique in which a program extracts large amounts of data from a website. As we know in the world the total number of websites is above one billion and most of users or owner want to clone code of some other website. there are several programming language for web scraping like java, python, php etc. but if you need to so in laravel then you also finding something like data Scraper in laravel then you can do it by following this tutorial.

Step 1: Install Package

first of all we will install laravel-goutte package by following composer command in your laravel 5.6 application.

composer require weidner/goutte

After successfully install package, open config/app.php file and add service provider and alias.


'providers' => [




'aliases' => [


'Goutte' => Weidner\Goutte\GoutteFacade::class,


Step 2: Create Route

now, here we will create route for demo, then we will add one url and print title of that page posts. it is amazing so just copy bellow code and check how it works.


Route::get('/hdtuto', function() {

$crawler = Goutte::request('GET', '');

$crawler->filter('.blog-post-item h2 a')->each(function ($node) {




Now you can quick run and check it.

I hope you found your best tutorial....