Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Latte templates on PhpStorm?

Is it possible to debug Latte templates in PhpStorm in the same manner as one would debug plain PHP?

The documentation says:

If you are using an IDE with code stepping you can go through the generated PHP code of the template.

How to do this on PhpStorm?

UPDATE:

This depends on the environment, my question is related to Wordpress.

I already found out that, in Wordpress, the generated PHP files can be found in the cache (wp-content/uploads/cache/<theme>/_wplatte in my case).

It seems that the files are not re-generated each time a page is loaded, so one can set breakpoints there.

BUT: I am still willing to accept a better, more complete answer, if anyone has better guidelines to offer...

like image 413
masa Avatar asked Oct 16 '25 15:10

masa


2 Answers

You can use macro for settings breakpoints in compiled code {debugbreak}

like image 60
jasir Avatar answered Oct 18 '25 07:10

jasir


What I usually do when debugging templates or other generated code is setting a breakpoint at a place where the template is generated and then stepping inside until I get inside the generated file. Or you can use a breakpoint in a known method (inside a helper for example) and then step out until you're in the template.

I'm afraid that there is no chance to set up latte debugging at least up to the point where standardized sourcemaps are a thing :)

like image 26
Tomáš Fejfar Avatar answered Oct 18 '25 07:10

Tomáš Fejfar