Windy — Turn any HTML to Tailwind CSS! Learn more

Go back to Blog

Interactive debugging with Tinkerwell

Marcel Pociot

Since Tinkerwell 2.2, it is possible to interactivly debug your Laravel apps. You can think of it as a dd helper with super powers. It allows you to instantly open up Tinkerwell and make your variables available in Tinkerwell.

Here's a quick video of how that looks like:

To make use of this in your own Laravel application, you first need to install a little package:

composer require --dev beyondcode/tinkerwell-helper

Once the package is installed, you have access to a global helper method called tinker.

A simple example would be:

$user = User::first();

tinker($user);

This will open up Tinkerwell and you will have immediate access to the $user variable.

But you do not need to have a temporary variable, if you just want to inspect something. You can also do:

tinker(User::first());

This is also going to open up Tinkerwell, but as you seen we have not given the data a specific variable name. To access this variable in Tinkerwell, you can use the $temp0 variable name.

You can also pass multiple things to the tinkerwell helper:

tinker($user, "a string", "something else");

This will make three variables available in Tinkerwell, named $temp0, temp1 and $temp2.

The tinker helper method really helped me boost my development workflow. It is also extremely handy when you want to debug some data that happens inside a queued job. Just put the tinker method in there and inspect the data using Tinkerwell.

Please note, that this feature currently only works on MacOS.

Its time to Tinkerwell

The must-have tinker tool for every PHP and Laravel developer. This magical desktop app may not be able to fly. But when it comes to PHP code, it sure knows how to run.

Learn more