March 5th, 2022

Use dd(), dump() and ray() globally with Global Ray

Use dd(), dump() and ray() globally with Global Ray

As Laravel developers we are all familiar with Spatie and their significant contribution either to the framework itself or with the high quality laravel packages they develop. Most of us (including Taylor Otwell himself) are using Ray which is a beautiful and lightweight tool enhancing the dd() or dump() functionality.

While Ray is great, you still have to install it per project in order to be able to use it and when you're not in that project's context, you either pull in ray via composer or in some cases you can't use it at all.

Recently, Freek Van der Herten from Spatie announced the release of Global Ray.

Global Ray allows you to use dd(), dump() and ray() functions globally without being limited to the project's context as before.

Getting started with Global Ray

You can install Global Ray, globally with just two shell commands:

1composer global require spatie/global-ray
2global-ray install

The install command will register global-ray-loader.php in the auto_prepend_file directive of your php.ini. This means that Global Ray will start when PHP starts.

More about how everything works in Freek's release post.

Happy debugging!

Statamic Ninja

Comments

Marian Pop

PHP / Laravel Developer. Writing and maintaining @LaravelMagazine. Host of "The Laravel Magazine Podcast". Pronouns: vi/vim.

Subscribe to our newsletter

Get latest news, tutorials, community articles and podcast episodes delivered to your inbox.

Weekly articles
We send a new issue of the newsletter every week on Friday.
No spam
We'll never share your email address and you can opt out at any time.