spatie/laravel-ray
Send Laravel debug output to Ray, Spatie’s desktop debugging app. Use a consistent API to inspect variables, arrays, HTML, queries and more, measure performance, and pause execution. Works across Laravel/PHP with Ray’s rich UI.
spatie/laravel-ray is a debugging-first package, aligning perfectly with Laravel applications where real-time debugging (e.g., queries, variables, exceptions) is critical. It integrates seamlessly with Laravel’s event system, service container, and Blade templates, making it a low-friction addition to existing debugging workflows.measure directive and query watchers enable performance bottlenecks identification, which is valuable for optimizing Laravel applications under load.spatie/ray dependency). Leverages Laravel’s service provider and facade patterns for minimal boilerplate.ray() helper, Blade directives like @ray) and does not modify core application logic. Existing dd(), dump(), or Log usage can coexist.@ray, @xray) enable runtime variable inspection directly in views, which is particularly useful for debugging UI logic.RAY_MAX_MESSAGES) to mitigate this.strtolower null handling). Laravel 11–13 support is confirmed, but older versions (pre-Laravel 9) may require backporting.Ray::ignore()) and environment-based toggling (config('ray.enabled')), but teams must enforce least-privilege usage in production.Debugging Workflow Alignment:
Performance Impact:
RAY_MAX_MESSAGES need tuning to avoid network bottlenecks?Data Sensitivity:
Tooling Ecosystem:
Long-Term Maintenance:
Pilot Phase:
RAY_ENABLED=false by default./admin routes) via config('ray.enabled').ray() sparingly to test output volume and performance impact.Gradual Rollout:
dd()/dump() calls with ray() for structured debugging.@ray, @xray) in templates to inspect view data.Production Readiness:
RAY_ENABLED=true in .env) for emergencies.RAY_MAX_MESSAGES=10 to limit output volume.Ray::ignore() to exclude sensitive data (e.g., passwords, tokens).spatie/ray (≥v1.45.0), which may introduce minor breaking changes (monitor Spatie’s changelog).Installation:
composer require spatie/laravel-ray
php artisan vendor:publish --provider="Spatie\Ray\RayServiceProvider"
.env and config/ray.php.Core Setup:
config/app.php:
'aliases' => [
'Ray' => Spatie\Ray\Ray::class,
],
Debugging Activation:
if (app()->environment('local') || auth()->user()->isDebugger()) {
Ray::enable();
}
dd($var) with ray($var) for structured output.Advanced Features:
Ray::queryWatcher()->enable();
@ray in Blade to inspect variables:
@ray($user)
Ray::measure('user_creation', function () {
User::create([...]);
});
Monitoring:
Ray::ignore('password', 'api_token');
RAY_MAX_MESSAGES=20
spatie/ray updates; Laravel’s package auto-loader ensures compatibility.spatie/ray for breaking changes (e.g., API shifts in Ray’s desktop app).composer.json if using **How can I help you explore Laravel packages today?