GSA Instagram Facebook Twitter LinkedIn

INtelligent Dev: Laravel Telescope

Matt Stauffer has a full and in-depth write up of what Telescope does: it’s a nice UI for debugging Laravel. But I would like to touch briefly on two of my favorite things about Telescope.

First of all, there is the ‘Dumps’ feature. It essentially allows you to set a breakpoint in your code to dump out and inspect a variable while allowing the request to continue to completion. To use it, just use the ‘dump’ function in your controller:

dump($request['user']);

Then go to /telescope/dumps in your application to inspect the variable and what attributes are being set.

I find it to be a nice companion to the old ‘dd’ (dump and die) method.

The other feature in Telescope I will be using every day in my development workflow is ‘Mail’. I will no longer have to rely on MailTrap to test transactional emails. Now, I just set mail driver in my .env file to log:

MAIL_DRIVER=log

Then fire off a transactional email in my application and go to the ‘Mail’ section in Telescope. Here you will see the email class that was triggered, how many recipients it was sent to, and when it was sent.

Inspecting the details of the mail log reveals all the details of the sent email, and you can even download the .eml file and view the job (if your email was queued) that sent the email:

Telescope gets me one step closer to writing bug free code and does it beautifully.

Michael O'Neil • December 7, 2018


Previous Post

Next Post