spatie/ray
Send debug output from any PHP app to Ray, Spatie’s desktop debugging tool. Inspect arrays, HTML, queries, and more with a consistent API across Laravel/PHP/JS. Measure performance, pause execution, and keep fast, interactive feedback.
dd(), var_dump(), and logging with a real-time, interactive desktop UI. This is particularly valuable for Laravel applications where complex state (e.g., Eloquent models, API responses, or middleware chains) requires deep inspection.dump() and log() helpers while adding features like query tracing, performance metrics, and AI-assisted debugging.composer require + config publish (php artisan vendor:publish --provider="Spatie\Ray\RayServiceProvider"). No database migrations or schema changes are required.Typed property warnings). The RemoveRayCallRector (PHPStan/Rector) allows safe removal of debug code post-deployment..env). Debug overhead is negligible in development due to lazy evaluation and WebSocket-based streaming.localhost:8000 by default).ray() calls in production could clutter logs or bloat payloads if not guarded (e.g., if (app()->environment('local'))).->expand())./ray) be secured in shared environments (e.g., CI/CD, staging)? Is it restricted to localhost?dd()/log() with ray() consistently, or will it remain a "power-user" tool?ray() as a handler.__debugInfo().composer require spatie/ray).dd() calls with ray() in high-value flows (e.g., payment processing, API endpoints).ray()->ignoreFn() to exclude sensitive data (e.g., passwords, tokens).ray() to job payloads (e.g., ray($job->payload)).ray()->pause() for step-through debugging in the Ray UI.RemoveRayCallRector to strip debug code before production.RAY_ENABLED=false in .env for non-debug environments.| Component | Compatibility Notes |
|---|---|
| PHP 8.1–8.5 | Fully supported; PHP 8.5 deprecations patched. |
| Laravel 10–13 | Official support; Laravel 13 added in v1.47.0. |
| Symfony 6–7 | Works via Symfony components (e.g., HTTP Client, VarDumper). |
| Livewire 3 | Fixed in v1.37.4 to avoid rendering components instead of inspecting them. |
| Pest | Screen names and test context supported. |
| Queues | Debug job payloads; avoid in production unless guarded. |
| APIs | Use ray()->ignoreFn() to exclude sensitive API responses. |
.env/config/ray.php.dd() calls with ray().ray() in CI/CD for failure debugging.invade(), expand()).ray.php and .env settings). Key options:
ignore_fn: Exclude sensitive data (e.g., ray()->ignoreFn(fn($var) => $var instanceof User)).max_payload_size: Limit payload size (default: 1MB).enabled: Toggle via .env (RAY_ENABLED=true).localhost:8000) is open.ray()->expand() for complex objects or increase max_payload_size.if (app()->isLocal())..env).if (app()->environment('local')).max_payload_size to avoid memory issues.| Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Ray App Unavailable | Debug output lost. | Fallback to Log::debug() or dd(). |
| Network Blocked | WebSocket failures. | Use RAY_WS_URL=http://localhost:8000 explicitly. |
| Payload Too Large | Debug data truncated. | Increase max_payload_size or use ->ignoreFn(). |
| Sensitive Data Leaked |
How can I help you explore Laravel packages today?