PHP code example of moinul / laravel-broken-link-scanner

1. Go to this page and download the library: Download moinul/laravel-broken-link-scanner 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/ */

    

moinul / laravel-broken-link-scanner example snippets


return [
    // The URL to start scanning from
    'start_url' => env('APP_URL', 'http://localhost'),

    // How many links deep should the crawler go? Set to -1 for unlimited
    'max_depth' => env('BROKEN_LINKS_MAX_DEPTH', 5),

    // How many URLs to check simultaneously
    'concurrency' => env('BROKEN_LINKS_CONCURRENCY', 10),

    // How long to wait for each request (in seconds)
    'timeout' => env('BROKEN_LINKS_TIMEOUT', 10),

    // The user agent string to use when making requests
    'user_agent' => env('BROKEN_LINKS_USER_AGENT', 'Laravel Broken Link Scanner'),

    // The database table to store broken links in
    'storage_table' => 'broken_links',
];

use Moinul\LinkScanner\Facades\LinkScanner;

// Scan using config start_url
LinkScanner::scan();

// Scan specific URL
LinkScanner::scan('https://example.com');
bash
php artisan vendor:publish --provider="Moinul\LinkScanner\LinkScannerServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Moinul\LinkScanner\LinkScannerServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="Moinul\LinkScanner\LinkScannerServiceProvider" --tag="views"