Http facade is built on Symfony HttpClient, so Escargot’s core functionality integrates seamlessly.InMemoryQueue or DoctrineQueue with minimal effort.DoctrineQueue works with Laravel’s Eloquent/Query Builder, but a custom queue adapter could be built for Laravel’s database connection.InMemoryQueue, crawls won’t survive process restarts. Mitigation: Use DoctrineQueue or a Redis-backed queue in Laravel.Symfony HttpClient’s delay()).HtmlCrawlerSubscriber may require additional libraries (e.g., symfony/dom) for robust HTML processing. Laravel’s str or html helpers could supplement this.InMemoryQueue) or database locks (DoctrineQueue) could become bottlenecks. Mitigation: Use LazyQueue with a fast primary queue (e.g., Redis) and persistent fallback (e.g., database).HtmlCrawlerSubscriber vs. custom JSON parsers).DoctrineQueue or a Laravel queue (e.g., Redis) is mandatory.ExceptionSubscriberInterface can be extended for custom logic.Http facade for consistency.Escargot and its dependencies (queues, subscribers) as Laravel services.database, redis) as the primary queue, with LazyQueue for fallback persistence.EscargotCommand to trigger crawls via php artisan escargot:crawl.DoctrineQueue (if not using Laravel’s native queues).jobs table or a custom table.composer require terminal42/escargot symfony/http-client symfony/dom
// app/Providers/EscargotServiceProvider.php
public function register()
{
$this->app->singleton(Escargot::class, function ($app) {
$queue = new LazyQueue(
new RedisQueue(), // Primary: Laravel Redis queue
new DoctrineQueue($app['db']) // Fallback: Laravel DB
);
return Escargot::createFromJobId(
$app['config']['escargot.job_id'],
$queue
);
});
}
App\Subscribers\DataExtractorSubscriber) implementing SubscriberInterface.$escargot = $this->app->make(Escargot::class);
$escargot->addSubscriber(new RobotsSubscriber());
$escargot->addSubscriber(new HtmlCrawlerSubscriber());
$escargot->addSubscriber(new DataExtractorSubscriber());
// app/Console/Commands/EscargotCrawl.php
public function handle()
{
$escargot = app(Escargot::class);
$escargot->crawl();
}
app/Console/Kernel.php):
protected function schedule(Schedule $schedule)
{
$schedule->command('escargot:crawl')->dailyAt('3:00');
}
.env:
QUEUE_CONNECTION=redis
LazyQueue to combine speed (Redis) and persistence (database):
$queue = new LazyQueue(
new RedisQueue(), // Fast primary queue
new DoctrineQueue($app['db']) // Persistent fallback
);
HttpClient, DomCrawler) ensure seamless integration.DoctrineQueue works with Laravel’s Eloquent or Query Builder, but a custom adapter could use Laravel’s DB facade directly.CrawlStarted, UriProcessed) for cross-service communication.RobotsSubscriber and HtmlCrawlerSubscriber.InMemoryQueue for validation.InMemoryQueue with DoctrineQueue or Laravel’s queue system.LazyQueue with Redis + database).dispatch() crawls as jobs).HttpClient). Laravel’s built-in Symfony packages will handle most updates, but custom subscribers may need adjustments.php artisan queue:work) will handle Escargot’s queue processing. Supervisor or Horizon can manage worker processes.DoctrineQueue, ensure Laravel’s database is optimized (e.g., indexes on job_id).How can I help you explore Laravel packages today?