- How do I install spatie/global-ray?
- Run composer global require spatie/global-ray, then run global-ray install. The installer adds an auto_prepend_file entry pointing to global-ray-loader.php in your php.ini. After that, ray(), rd(), dump() and dd() are available in every PHP file without per-project setup.
- Does spatie/global-ray work with Laravel?
- It works alongside Laravel, but it is not a Laravel package and does not belong in your project dependencies. If a framework-specific integration such as spatie/laravel-ray is detected, that integration is used instead of global-ray. Treat global-ray as a fallback for one-off scripts, legacy non-framework PHP and CLI tools.
- Do I need to add spatie/global-ray to my project's composer.json?
- No. It is installed globally with composer global require, so nothing appears in composer.json, composer.lock or your build artifacts. That also means there is no version pinning or code review gate for the tool on a per-repository basis.
- How do I uninstall spatie/global-ray?
- Run global-ray uninstall first, then composer global remove spatie/global-ray. The order matters: the php.ini edit survives removing the package, so removing the Composer package first leaves a dangling auto_prepend_file pointing at a deleted loader script. That misconfiguration breaks every PHP process on the machine.
- Why do all my PHP commands fail after upgrading PHP with global-ray installed?
- auto_prepend_file is evaluated before your code runs, so a broken loader takes down artisan, composer, PHPUnit and PHPStan at the same time with an early, confusing error. The package ships version-pinned PHAR payloads per PHP version, so switching PHP versions can point the loader at the wrong binary. Re-run global-ray install after any PHP upgrade or version switch.
- Do I need a paid Ray license to use spatie/global-ray?
- The global-ray package itself is open source and free to install, but it sends output to Ray, which is a commercial desktop app. The free trial allows 20 messages per session, and full use requires a purchased license. Budget for Ray seats if you plan to roll this out across a team.
- Is it safe to use global-ray in CI pipelines or Docker containers?
- No. Restrict it to individual developer workstations. Auto-prepending debug functions into CI runners, shared build agents or container images silently changes the execution environment of your pipelines and injects globals into code you did not write.
- What is the difference between spatie/global-ray and spatie/laravel-ray?
- spatie/laravel-ray is a per-project Composer dependency with a pinned version in composer.json, intended for Laravel applications. spatie/global-ray is a machine-level tool that injects ray(), rd(), dump() and dd() into every PHP process and defers to laravel-ray when it is present. Use laravel-ray inside Laravel projects and scope global-ray to scripts that live outside a framework.
- Which PHP versions does spatie/global-ray support?
- It targets modern PHP releases and ships separate PHAR payloads per PHP version, with support added over time for releases such as PHP 8.2. Because the loader is pinned to a PHP-specific PHAR, upgrading or switching PHP usually requires re-running global-ray install to restore working debug functions.
- Does global-ray work on Windows, Laravel Herd and Valet?
- Yes. The installer has explicit Windows support, including an elevation retry when writing php.ini, and it handles the macOS Herd and Valet php.ini path differences. Which config file actually gets edited depends on your local setup, so verify the php.ini path after installing.