spatie/laravel-visit
Adds a php artisan visit command to quickly hit any route in your Laravel app and inspect the response. Shows colorized HTML or JSON output plus request results, with options like visiting by route name and logging in a user before the request.
visit) without modifying core Laravel workflows, making it ideal for debugging, testing, or manual route validation in CI/CD pipelines or local development.curl or browser) are cumbersome (e.g., headless servers, CI).spatie/laravel-activitylog or similar), and middleware simulation, aligning with modern Laravel ecosystems.composer require spatie/laravel-visit). Compatible with Laravel 10+ (as of last release).Artisan::call() for automated route validation.php artisan route:list or Laravel’s --verbose flags.visit --user=admin) assumes guard/middleware compatibility. Test with custom auth systems.curl)?--user flag suffice, or are custom guards needed?RouteServiceProvider and Http/Kernel.Process component for test integration.curl/Postman for quick route inspection.composer require spatie/laravel-visit./dashboard, /api/v1/users).php artisan visit /profile --user=admin).curl commands in scripts with visit..gitignore if used for local dev only.# GitHub Actions example
- run: php artisan visit /health-check --json | jq '.status'
--headers support).composer.json constraints).web, api groups).php artisan route:cache).composer require spatie/laravel-visit.php artisan visit / (root route).alias visit-dashboard='php artisan visit /dashboard --user=admin').--verbose or Laravel’s app:debug commands.parallel-lint + custom scripts).| Scenario | Impact | Mitigation |
|---|---|---|
| Route not found | Command exits with error code. | Validate routes with php artisan route:list. |
| Authentication failure | 401/403 responses in output. | Test auth flows separately. |
| Middleware errors | Silent failures (e.g., 500). | Combine with php artisan route:clear. |
| CI/CD flakiness | Non-deterministic output. | Use --json for machine-readable results. |
| PHP version incompatibility | Installation fails. | Pin PHP version in composer.json. |
# Basic usage
php artisan visit /dashboard
php artisan visit dashboard --user=admin
# JSON output (CI-friendly)
php artisan visit /api/health --json
# With custom headers
php artisan visit /webhook --header="X-Custom: value"
visit").How can I help you explore Laravel packages today?