- How do I install spatie/laravel-ray in a Laravel project?
- Run `composer require spatie/laravel-ray` and execute `php artisan ray:install`. The package adds a `ray()` helper and Blade directive `@ray` for debugging. No additional configuration is needed for basic usage, but check `.env` for environment-specific settings.
- Does spatie/laravel-ray work with Laravel 13 or 11?
- Yes, the package officially supports Laravel 11–13 (as of v1.43.6). Older versions (e.g., Laravel 10) may require manual adjustments, but the package maintains backward compatibility. Always check the [CHANGELOG](https://github.com/spatie/laravel-ray/blob/main/CHANGELOG.md) for version-specific notes.
- Can I use ray() in production without performance overhead?
- Ray output is disabled in production by default. Use `if (app()->environment('local')) ray($data);` or set `RAY_ENABLED=false` in `.env` to prevent accidental leaks. The package adds negligible overhead (~1–5ms per call) only when active.
- How does ray() compare to Laravel Telescope or Xdebug?
- Ray offers a lightweight, desktop-based alternative to Telescope’s web UI and Xdebug’s IDE integration. Unlike Telescope, it’s not a full monitoring tool, but it excels at real-time inspection of variables, HTML, and performance metrics—ideal for local debugging. Use Telescope for production monitoring and Ray for deep local sessions.
- Will ray() expose sensitive data like API tokens or PII?
- Yes, if used carelessly. Always wrap `ray()` calls in `if (app()->environment('local'))` checks. For extra safety, use context filters (e.g., `ray($data)->except(['password', 'token'])`) or avoid sending sensitive data entirely. Ray messages are local-only by default.
- Can I measure performance with ray() like in Laravel’s built-in tools?
- Yes, Ray includes performance measurement tools. Use `ray()->performance('section_name')` to time execution blocks. The desktop app displays execution time, memory usage, and even allows pausing execution during debugging—similar to Xdebug but without IDE dependencies.
- How do I debug Blade templates or Eloquent queries with Ray?
- Use the `@ray` Blade directive to inspect template variables or wrap Eloquent queries in `ray()` calls. For advanced query debugging, enable the built-in query watcher via `ray()->enableQueryWatcher()` in your `AppServiceProvider`. Ray will log raw SQL, bindings, and execution time.
- Does spatie/laravel-ray support JavaScript/TypeScript debugging alongside PHP?
- Yes, Ray is a cross-language tool. Install the [JavaScript/TypeScript client](https://myray.app/docs/javascript) to send debug output from Laravel Mix/Vite or frontend frameworks. All messages appear in the same Ray desktop UI, enabling full-stack debugging without context-switching.
- Are there alternatives to spatie/laravel-ray for Laravel debugging?
- For local debugging, consider Laravel Telescope (web-based), Xdebug (IDE integration), or Laravel’s built-in `dd()`/`dump()`. For cross-language debugging, Ray is unique in its desktop-first approach. If you need production monitoring, Telescope or Laravel Debugbar are better choices.
- How do I clean up old Ray messages or reset the app?
- Run `php artisan ray:clean` to clear stored messages. This uses Rector under the hood, so avoid running it in production unless necessary. For persistent issues, check Ray’s settings or reinstall the package (`composer remove spatie/laravel-ray && composer require spatie/laravel-ray`).