Larascraper

Larascraper is a scraping toolkit for Laravel. It splits fetching from parsing: a Scraper orchestrates the request, a Crawler turns the document into data, and a Spider drives many of them concurrently over a whole source.
Two engines sit behind the same code. A browser driver built on Puppeteer for pages that need JavaScript or interaction, and a plain HTTP driver for everything else. Swapping between them is one method call, and the shape of your code does not change.
Written against version 3.4.
Why it exists
Scraping in PHP has a fault line running through it. Static pages go through Guzzle, and the code is a fetch and a parse. Pages that render in JavaScript cannot be fetched at all, so they go through a headless browser, which in PHP means shelling out to a Node script and parsing whatever comes back on stdout.
That gives you two toolchains with two error models, two ways to express "wait for this to appear", one of which does not exist, and glue in between that nobody tests. And the split is not stable: a site you scrape with Guzzle today ships a frontend rewrite next quarter and now needs the browser, which is not a config change but a rewrite into the other toolchain.
Larascraper's answer is that transport is a detail, not an architecture. A scraper says what to get; how the bytes arrive is swappable:
$this->scrape($url)->crawl(BikeCrawler::class)->run(); // browser $this->scrape($url)->driver('http')->crawl(BikeCrawler::class)->run(); // plain HTTP
The three pieces
| Scraper | Orchestrates one fetch: driver, proxy, retries, page actions, and what to do with the result. |
| Crawler | Parsing only. Receives a document, returns data, and has no idea how the document was fetched. Reusable across scrapers and testable against a fixture. |
| Spider | Walks a whole source and drives many Scrapers concurrently, threading one shared session through the run. |
A ScraperResponse comes out the far end, carrying data, success and error.
Where it is used
Larascraper is the scraping layer behind crowd.legal, where it scrapes official state gazettes worldwide: captcha-gated PDF viewers, scanned documents with no text layer, and search forms that may or may not return results. It also runs the game ingestion for Duración De.
Requirements
- PHP
8.2,8.3,8.4and8.5 - Laravel
10,11,12and13
Every combination is covered by the test suite on each push, and once a week, so a new framework release that breaks the package shows up there first.
The browser driver additionally needs Node and Chrome, installed for you by php artisan larascraper:install. The HTTP driver needs neither.
How to read this
Chapters 2 to 6 are the core loop and are worth reading in order. Everything after that is a capability you reach for when a site demands it, and can be read on its own.
Released under the MIT license.