spatie/http-status-check
CLI tool to crawl a website and report HTTP status codes for every link. Scan internal and optionally external URLs, control concurrency for speed, and export failing (non-2xx/3xx) links to a file for quick auditing.
HttpClient facade).status_checks table).StatusCheck to add Laravel-specific logic like auth headers or rate limiting).| Risk Area | Mitigation Strategy |
|---|---|
| Performance | Crawling large sites may hit memory/time limits. Mitigate with: |
- Queue workers (Laravel queues + spatie/queueable for async processing). |
|
- Rate limiting (customize HttpClient with delays). |
|
| False Positives | Ignore dynamic routes (e.g., /api/user/{id}) via regex exclusions in config. |
| Authentication | Requires manual setup for protected routes (e.g., add headers via StatusCheck::withHeaders()). |
| Maintenance | Archived status (no active updates). Risk of PHP/Symfony deprecations. |
| - Fork or wrap in a composer package to isolate dependencies. |
laravel-debugbar link checker) or dedicated services (e.g., Screaming Frog API).php artisan check:links) for consistency.check:links:batch).spatie/array-to-xml for XML output.spatie/laravel-schedule for cron-like scheduling.composer global require spatie/http-status-check).app/Console/Commands/CheckLinksCommand.php):
use Spatie\HttpStatusCheck\StatusCheck;
use Illuminate\Console\Command;
class CheckLinksCommand extends Command {
protected $signature = 'check:links {url?}';
protected $description = 'Check HTTP status codes of all links on a site';
public function handle() {
$check = new StatusCheck($this->argument('url') ?? config('app.url'));
$results = $check->check();
$this->output->table(['URL', 'Status'], $results);
}
}
app/Console/Kernel.php:
protected function schedule(Schedule $schedule) {
$schedule->command('check:links')->dailyAt('2:00');
}
StatusCheckResult) for storage/alerts./api/* routes).StatusCheck class).composer why-not-update to track risks.HttpClient timeout settings.StatusCheck::withHeaders().--verbose flag or Laravel’s tap() for inspection.laravel-shift/queue-worker monitoring.php.ini adjustments (e.g., memory_limit=-1).| Failure Scenario | Detection Method | Recovery Strategy |
|---|---|---|
| CLI Command Fails | Laravel scheduler logs | Retry with --retry flag or queue job. |
| Database Overload | Slow queries | Batch inserts; use chunk() for models. |
| External API Unreachable | HTTP timeouts | Exponential backoff; alert team. |
| False Negatives | Missing routes in results | Validate with manual checks or Screaming Frog. |
php artisan check:links).How can I help you explore Laravel packages today?