PHP code example of spekulatius / spatie-crawler-toolkit-for-laravel

1. Go to this page and download the library: Download spekulatius/spatie-crawler-toolkit-for-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spekulatius / spatie-crawler-toolkit-for-laravel example snippets


Crawler::create()
    ->setCrawlQueue(new \Spekulatius\SpatieCrawlerToolkit\Queues\CacheCrawlQueue($url))
    ->startCrawling($url);

Crawler::create()
    ->setCrawlObserver(new \Spekulatius\SpatieCrawlerToolkit\Observers\CrawlLogger)
    ->startCrawling($url);

$eventObserver = new \Spekulatius\SpatieCrawlerToolkit\Observers\CrawlEvents;

Crawler::create()
    ->setCrawlObserver($eventObserver)
    ->startCrawling($url);

$eventObserver = new \Spekulatius\SpatieCrawlerToolkit\Observers\CrawlEvents('my-crawl');
bash
php artisan vendor:publish --tag=crawler-toolkit-config