Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Ray Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Debugging Paradigm: spatie/laravel-ray aligns perfectly with Laravel’s debugging ecosystem, complementing native tools like dd(), dump(), and Log::debug(). It integrates seamlessly with Laravel’s service container and event system, enabling real-time debugging via a desktop app (Ray) without polluting logs or requiring CLI access.
  • Observability Layer: Acts as a lightweight, non-intrusive observability layer, capturing:
    • Variable states (e.g., ray($user)).
    • SQL queries (via QueryWatcher).
    • HTTP requests/responses (via RequestWatcher).
    • Exceptions with stack traces and context.
    • Blade templates and emails (via BladeWatcher and MailWatcher).
  • Performance Impact: Minimal overhead during development (configurable via .env). Production-ready with conditional toggling (e.g., APP_DEBUG=false disables Ray entirely).
  • Extensibility: Supports custom watchers (e.g., for Eloquent events, queue jobs) via Laravel’s service provider hooks.

Integration Feasibility

  • Laravel Compatibility: Officially supports Laravel 11–13 (as of v1.43.x) with backported fixes for PHP 8.1–8.5. No breaking changes in recent releases.
  • Dependency Graph:
    • Core: spatie/ray (v1.45+), laravel/framework (version-agnostic).
    • Optional: zbateson/mail-mime-parser (for email debugging), rector/rector (for code cleanup).
  • Bootstrapping: Zero-config setup via composer require + php artisan ray:install. Auto-detects Laravel version and applies minimal patches (e.g., PHP 8.5 deprecations).
  • IDE Support: Zero IDE configuration required. Works alongside Xdebug for advanced debugging.

Technical Risk

  • Low Risk:
    • MIT-licensed, battle-tested (317 stars, active maintenance).
    • Isolated to debug context; no runtime dependencies in production.
    • Spatie’s track record (e.g., laravel-permission, laravel-backup) reduces vendor lock-in risk.
  • Mitigable Risks:
    • Network Dependency: Ray requires a local desktop app and internet connection (for cloud-based Ray). Mitigate by:
      • Using ray:offline mode for air-gapped environments.
      • Self-hosting the MCP server (Ray’s backend).
    • Performance: Heavy debugging (e.g., ray() in loops) may slow requests. Mitigate via:
      • Conditional if (app()->environment('local')) ray($var).
      • Rate-limiting via .env (RAY_MAX_MESSAGES_PER_MINUTE=100).
    • Data Leakage: Sensitive data (e.g., passwords) in ray() calls. Mitigate via:
      • Sanitization middleware (e.g., Ray::ignore([Password::class])).
      • Environment-specific configurations (e.g., RAY_ENABLED=false in staging/prod).

Key Questions

  1. Debugging Workflow:
    • How will teams transition from dd()/Log::debug() to Ray? (Training + incentives for adoption.)
    • Will Ray replace existing tools (e.g., Laravel Telescope, Sentry) or augment them?
  2. Production Use:
    • Is Ray enabled in non-development environments? If so, how are sensitive data risks managed?
    • Are there plans to integrate with APM tools (e.g., New Relic, Datadog) for unified observability?
  3. Infrastructure:
    • For cloud/headless deployments, how will the Ray desktop app be accessed? (SSH tunneling? Remote debugging?)
  4. Cost:
    • The free tier limits messages to 20/session. Will teams purchase licenses for full access?
  5. Maintenance:
    • How will the team handle Ray-specific issues (e.g., false positives in query watchers) vs. Laravel core issues?

Integration Approach

Stack Fit

  • Laravel-Centric: Designed for Laravel’s ecosystem (e.g., Eloquent, Blade, Queues). Leverages Laravel’s:
    • Service container (for dependency injection).
    • Event system (e.g., QueryExecuted).
    • Artisan commands (e.g., ray:clean to remove debug calls).
  • Multi-Language: Supports PHP, JavaScript, and other Spatie Ray clients, enabling full-stack debugging.
  • Toolchain Compatibility:
    • CI/CD: Works with Laravel Pint, PHPStan, and Rector for static analysis.
    • Testing: Non-intrusive; debug calls can be mocked in tests (e.g., Ray::shouldReceive('send')->never()).
    • Monitoring: Can feed into DataDog/New Relic via custom watchers.

Migration Path

  1. Pilot Phase:
    • Install in a non-critical branch: composer require spatie/laravel-ray.
    • Configure via .env:
      RAY_ENABLED=true
      RAY_PROJECT_NAME="MyApp"
      
    • Test with ray() in a single controller/action.
  2. Gradual Adoption:
    • Replace dd() with ray() in critical paths (e.g., payment flows).
    • Use ray:clean to remove debug calls post-release.
    • Train teams on Ray’s UI (e.g., filtering, pausing execution).
  3. Full Rollout:
    • Enable in staging with RAY_ENABLED=true.
    • Monitor performance impact (e.g., via Laravel Debugbar).
    • Disable in production or restrict to admin routes.

Compatibility

  • Laravel Versions: Supports 11–13 (as of v1.43.x). Backward-compatible with older versions via ^1.0 constraint.
  • PHP Versions: PHP 8.1+ (with fixes for 8.5 deprecations). No 7.x support.
  • Dependencies:
    • Conflicts: None reported. Uses illuminate/support for Laravel-specific features.
    • Optional: mail-mime-parser only needed for email debugging.
  • Customizations:
    • Override default watchers (e.g., app/Providers/RayServiceProvider.php).
    • Extend with custom watchers (e.g., for custom Eloquent events).

Sequencing

  1. Pre-requisites:
    • Install Ray desktop app on all dev machines.
    • Ensure PHP 8.1+ and Laravel 11+.
  2. Core Integration:
    • Publish config: php artisan vendor:publish --provider="Spatie\Ray\RayServiceProvider".
    • Configure .env and config/ray.php.
  3. Feature Rollout:
    • Phase 1: Basic ray() calls + exception debugging.
    • Phase 2: Query/Blade/Mail watchers.
    • Phase 3: Performance profiling (ray()->measure()).
  4. Post-Launch:
    • Set up ray:clean in CI for debug call removal.
    • Document Ray-specific workflows (e.g., "How to debug a failed queue job").

Operational Impact

Maintenance

  • Package Updates:
    • Minor updates (e.g., v1.43.x → v1.44.x) are low-risk (backward-compatible).
    • Major updates (e.g., Laravel 14 support) require testing but are handled by Spatie.
    • Dependency updates (e.g., spatie/ray v1.45+) are automated via composer update.
  • Debug Call Management:
    • Use php artisan ray:clean to remove debug calls pre-release.
    • Git hooks to block ray() calls in production branches.
  • Configuration Drift:
    • Centralize .env and config/ray.php in a shared template.
    • Use Laravel Envoy or Ansible to sync Ray settings across environments.

Support

  • Troubleshooting:
    • Common Issues:
      • Ray not receiving messages: Check .env (RAY_ENABLED=true), firewall rules, and Ray app connection.
      • Performance slowdowns: Disable watchers or reduce RAY_MAX_MESSAGES.
      • Data not showing: Verify ray() is called within a request lifecycle (not in CLI commands).
    • Debugging Ray Itself: Use ray()->debug() to inspect Ray’s internal state.
  • Escalation Path:
    • Spatie’s GitHub issues for package bugs.
    • Laravel Discord/Forums for integration questions.
    • Self-hosted MCP server for enterprise support.
  • Documentation:
    • Maintain a team wiki with:
      • Ray quick-start guide.
      • Common patterns (e.g., debugging API requests, Blade templates).
      • Sensitive data handling policies.

Scaling

  • Performance:
    • Development: Minimal impact (Ray is local).
    • Production: Disable entirely (RAY_ENABLED=false) or use conditional logic:
      if (app()->environment('local') ||
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony