The folks over at Spatie have released a new tool called Ray that helps you with debugging.
Ray is a beautiful, lightweight desktop app that helps you debug your app. After installing one of the libraries to send information to Ray, you can use the
ray()
function to quickly dump stuff. Any variable(s) that you pass to Ray will be displayed.
Since Spatie mainly develops with Laravel it plays very nice with it. It supports logging all performed queries or properly displaying the contents of any Eloquent Model / Mailable for example.
ray('Hello world');
ray(['a' => 1, 'b' => 2])->color('red');
ray('multiple', 'arguments', 'are', 'welcome');
ray()->showQueries();
User::firstWhere('email', 'john@example.com');
At its core Ray is “simply” an app that listens for incoming messages on a specific port (e.g. 23517
). That means you can use it with any other programming language, as long as you send it the proper (JSON) payload. Libraries to use Ray with WordPress or JavaScript are already available too.
Ray →
Ray Docs →
Ray Introductory Blogpost →
💁♂️ Sidenote: To debug JavaScript I’d recommend the DevTools you already have though, as they’re already built for it. To debug from a remote source you could use something like JSConsole or get knee-deep in ADB and remote debugging protocols. But from a technological point of view it’s pretty cool that you can use Ray for it if you wanted to.