fperdomo/scanner

Scan an array or file of URLs and report inaccessible URLs

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/fperdomo/scanner

1.0.0 2025-11-17 17:17 UTC

This package is auto-updated.

Last update: 2025-11-17 21:32:51 UTC


README

A lightweight, framework-agnostic PHP package to scan large lists of URLs efficiently using chunked asynchronous processing. Designed for use inside Laravel commands or any PHP application where non-blocking URL checking is required Logo for url scanner

use

use Fperdomo\App\Url\Scanner;

$urls = Scanner::create()
->fromArray([
    'https://example.com',
    'https://another-example.com',
])->getInvalidUrls();

From a file:

use Fperdomo\App\Url\Scanner;

$scanner = Scanner::create()
->fromFile('url.csv')
->onProgress(funtion ($progress) {);
    // show progress
    print_r('');
    print_r('========================================');
    print_r(sprintf('Total URLs processed: %d', $progress->totalRowsProcessed));
    print_r(sprintf(
        'Valid URLs: %d (%.1f%%)',
        $progress->resultsOk,
        $progress->validPercentage()
    ));
    print_r(sprintf(
        'Invalid URLs: %d (%.1f%%)',
        $progress->resultsErr,
        $progress->invalidPercentage()
    ));
    print_r('========================================');
});
Benchmark::dd(fn () => $scanner->scan());

From a file async:

use Fperdomo\App\Url\Scanner;

$urls = Scanner::create()
->fromFile('url.csv')
->field('url')
->chunk(1000)
->onProgress(funtion ($progress) {);
    // show progress
    print_r('');
    print_r('========================================');
    print_r(sprintf('Total URLs processed: %d', $progress->totalRowsProcessed));
    print_r(sprintf(
        'Valid URLs: %d (%.1f%%)',
        $progress->resultsOk,
        $progress->validPercentage()
    ));
    print_r(sprintf(
        'Invalid URLs: %d (%.1f%%)',
        $progress->resultsErr,
        $progress->invalidPercentage()
    ));
    print_r('========================================');
});
Benchmark::dd(fn () => $scanner->scan());