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
Requires
- php: >=8.3
- nunomaduro/pokio: ^0.1.1
- spatie/simple-excel: *
Requires (Dev)
- illuminate/http: ^12.38
- pestphp/pest: ^4.1
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
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());