fabpot/goutte
Goutte is a PHP web scraping and web testing library built on Symfony components. It provides a simple API to crawl pages, submit forms, click links, and extract content with CSS selectors—handy for quick crawlers, monitors, and functional checks.
Pros:
symfony/http-client, symfony/dom-crawler), reducing dependency bloat.Cons:
HttpBrowser, with no future development. Teams must plan for migration to avoid technical debt.HttpClient with curl options) are clunky and unreliable.$this->app->bind(Goutte\Client::class, function ($app) {
return new Goutte\Client($app->make(Symfony\Component\BrowserKit\HttpBrowser::class));
});
php artisan scrape:competitor).HttpBrowser may evolve incompatibly. Teams should audit dependencies and plan a parallel implementation using Symfony components directly.RetryMiddleware).DomCrawler::filter().symfony/browser-kit + symfony/http-client directly to avoid deprecation risk?HttpClient alone, or is a headless browser (e.g., PHP-Puppeteer) required?BrowserKit and DomCrawler, which are first-class citizens in Laravel. No conflicts with core or popular packages (e.g., Laravel Excel, Spatie).$this->app->singleton(Goutte\Client::class, function ($app) {
$httpClient = new Symfony\Component\BrowserKit\HttpBrowser();
return new Goutte\Client($httpClient);
});
php artisan scrape:prices).HttpClient with retries, caching, or proxies.Client::request(), Crawler::filter()).HttpBrowser:
// Goutte
$client = new Goutte\Client();
$crawler = $client->request('GET', 'https://example.com');
// Symfony Alternative
$client = new Symfony\Component\BrowserKit\HttpBrowser();
$crawler = new Symfony\Component\DomCrawler\Crawler(
$client->request('GET', 'https://example.com')->getContent()
);
Goutte\Client with Symfony\Component\BrowserKit\HttpBrowser in non-critical paths first.GuzzleHttp\Middleware::retry()), caching (Laravel Cache), or parallel requests (Laravel Concurrency).symfony/http-client: For HTTP requests (replaces Guzzle if used elsewhere).symfony/dom-crawler: For HTML parsing (integrates with Laravel’s Blade/Collections).Crawler methods).HttpClient deprecations).DomCrawler quirks).How can I help you explore Laravel packages today?