- How do I install spatie/laravel-ray in a Laravel 12 project?
- Run `composer require spatie/laravel-ray` and register the service provider in `config/app.php` under `providers`. No additional steps are needed unless you want to publish the config file, which is optional.
- Can I use Ray for debugging in production, or is it only for development?
- Ray is designed for development. The free tier limits output to 20 messages per session, and exposing debug data in production risks sensitive information. Disable Ray in production or use `Ray::ignore()` for sensitive data.
- Will Ray slow down my Laravel application in production?
- Ray introduces minimal overhead, but it’s not recommended for production. The free tier throttles messages, and you can disable it entirely in production by removing the service provider or using environment checks.
- How do I exclude sensitive data (like API keys) from Ray logs?
- Use `Ray::ignore()` to exclude specific variables or data types. For example, `Ray::ignore(fn($data) => str_contains($data, 'secret_'))` will filter out sensitive strings. Combine this with environment-specific configurations.
- Does spatie/laravel-ray work with Laravel 13 and PHP 8.5?
- Yes, the package officially supports Laravel 11–13 and PHP 8.1+. It includes fixes for PHP 8.5 deprecations, such as null handling in `strtolower()`, ensuring compatibility with modern Laravel stacks.
- Can I use Ray alongside Laravel Telescope or Debugbar?
- Yes, Ray integrates seamlessly with other debugging tools. Use Ray for real-time inspection of variables, queries, and performance metrics, while Telescope or Debugbar can handle logging and historical data.
- How do I measure performance with Ray in Laravel?
- Use `Ray::performance()` to start a timer and `Ray::performance('name')->stop()` to measure execution time. Ray displays the duration in milliseconds, helping you identify bottlenecks in your code.
- Is there a way to customize what data Ray captures (e.g., only queries or specific variables)?
- Yes, Ray supports custom watchers. For example, you can create a watcher for Eloquent queries or Blade templates. Check the [Ray documentation](https://myray.app/docs/php/laravel) for examples on extending Ray’s functionality.
- What are the alternatives to spatie/laravel-ray for Laravel debugging?
- Alternatives include Laravel Telescope (built-in debugging and logging), Sentry (error tracking and performance monitoring), and Blackfire (profiler for performance optimization). Ray stands out for its real-time, cross-language debugging in a desktop app.
- How do I handle Ray licensing for a team of developers?
- Ray offers a free tier with limited features. For full access, purchase a license per developer or team. Spatie provides team licenses, and you can manage updates and licenses centrally through their platform. Check [Spatie’s pricing](https://spatie.be/products/ray) for details.