PHPstorm - Unable to set breakpoints in blade.php files
debug laravel phpstorm
I'm working on a Laravel application and can debug my controller php files fine, but Id like to also debug the blade.php files. With my current setup Ive followed all of jetbrains recommend settings for Laravel, (https://confluence.jetbrains.com/display/PhpStorm/Laravel+Development+using+PhpStorm#LaravelDevelopmentusingPhpStorm-DebuggingLaravelApplicationswithPhpStorm) but it is still not allowing my to set breakpoints in the blade.php files.
What could I be missing?
<?php xdebug_break(); ?>
into your blade file works pretty well. Even in my tests, PHPstorm jumps to the next PHP statement in some cases.
Why this works:
Laravel processes the blade file to a normal PHP file in the cache folder. But the PHP statement
xdebug_break(); will be transferred there and cause the program to halt at the position you want it to (in the cache file).
To close this question - phpstorm doesnt support this functionality at the moment. A work around provided by jetbrains support was to add *.blade.php to file type associations under PHP in the IDE settings, however, it still wasnt working for me after doing this.
It appears that they created a youtrack ticket in response to my request, if youd like to encourage jetbrains to work on this please upvote: youtrack.jetbrains.com/issue/WI-26476
PHPstorm - Unable to set breakpoints in blade.php files, I'm working on a Laravel application and can debug my controller php files fine, but Id like to also debug the blade.php files. With my current setup Ive followed� On the PhpStorm toolbar, toggle to start listening for incoming PHP debug connections, or choose Run | Start Listening for PHP Debug Connections from the main menu. Set a breakpoint in your code. Breakpoints can be set in the PHP context inside PHP, HTML, TWIG, BLADE, and files of other types. Line breakpoints can be set only on executable lines, but not on comments, declarations, or empty lines.
Even if you can get the IDE to enable breakpoints on the blade files, it won't work - Laravel composes a PHP file from the Blade file - it is this file that is eventually used when the script is run - not the Blade file.
This works for PHPStorm - but something similar might be possible in other IDEs.
Laravel (5) stores the composed files under storage/framework/views. These files have random generated file names - so it may be tricky to find the file you want. An easy way is to delete all these temp files and then refresh the page you want to debug. A new file will be created. In PHPstorm you can right-click on the file and select the file's extension type. (Not sure about other IDEs)
You will now be able to set breakpoints. Obviously you will need to make the changes in the Blade file - but this will at least help you to figure out what is wrong.
**Update: Alex's solution is easier! **
PhpStorm 2019.1 released: Debug Twig and Blade, Locate Dead , Set breakpoints on enter and exit of an internal PHP function (call breakpoint). Possibility to analyze files strictly even w/o declare(strict_types� Thanks to a Laravel 5.8 contribution for including the Laravel 5.8 Blade Template File Path in compiled templates, now you can set a breakpoint directly in a blade file instead of having to search for the compiled template and setting a breakpoint: Another Laravel-related feature in PhpStorm 2019.1 is a predefined Laravel code style setting.
As with the recent PHPstorm and Laravel 5.8 this should work now out of the box.
PHPstorm - Unable to set breakpoints in blade.php, I'm working on a Laravel application and can debug my controller php files fine, but Id like to also debug the blade.php files. With my current setup Ive followed� Breakpoints can be set at any time during the debugging process. Your breakpoints don't affect your source files directly, but the breakpoints and their settings are saved with your PhpStorm project so you can reuse them across debugging sessions. Place the caret at the desired line of the source code.
I devised an even better hack, which allows conditional debugging support, so that you aren't stuck with XDebug_break for the rest of eternity.
The single line expands as follows.
<?php if ( \app\utils\DebugLogger::EnableForBlades ( ) ) xdebug_break ( ) ; ?>
This statement has a couple of unusual features.
- Since blade files done't have use directives, the method name, \app\utils\DebugLogger::EnableForBlades is fully qualified.
- Since blade files seem to lack support for the usual code blocking mechanism, the one-line statement is devoid of braces, and is terminated by a semicolon.
EnableForBlades is a static method that queries an environment variable (one of those defined in .local.env), returning True if that variable evaluates to True. Otherwise, it returns False, and xdebug_break is suppressed.
PHPstorm - Unable to set breakpoints in blade.php files, PHPstorm - Unable to set breakpoints in blade.php files. 发表于2019-9-24 | | 暂无分类. I'm working on a Laravel application and can debug my controller php� Breakpoints can be set at any time during the debugging process. Your breakpoints don't affect your source files directly, but the breakpoints and their settings are saved with your PhpStorm project so you can reuse them across debugging sessions. Place the caret at the desired line of the source code.
PHPstorm - Unable to set breakpoints in blade.php files, I'm working on a Laravel application and can debug my controller php files fine, but Id like to also. Create a PHP debug server configuration. The term PHP debug server configuration denotes the settings that ensure HTTP access for debugging engines to interact with local and remote Web servers and set correspondence between files on the server and their local copies in the PhpStorm project.
How do you debug with blade and sage 9? - sage, How do you correctly debug blade? All I get is a Blade PHP error logging . com/questions/28501077/phpstorm-unable-to-set-breakpoints-in-blade-php-files. I dont know if Zend's debugger is available for free, but it looks like buggy and expensive commercial option. So if PhpStorm could add support for PHPDBG and improve IDE debugging interface, we would definitely switch to PhpStorm. Thanx for your response. Lubos
Phpstorm debug, Add breakpoints into your code and set PHPStorm to listen to incoming connections. Mar 09, 2015 � I think that is will be possible to debug using "File Watchers", to debug your php application right from your IDE is something that you can't 8 Blade templates, improvements and fixes for PHP, and all the fresh updates� Question Description. I decided to try Windows 10, but having problem to make terminal works inside WebStorm/PhpStorm. When I open terminal, sometimes it’s completely black, sometimes it loads the project folder but I cannot type there. There is a way to run it in the external window, but I just got accustome
- In what file -- original
.blade.phpor compiled blade file? You definitely cannot set it in original one -- because it's not executed.
- Thanks for the fast response, I didnt know that it was compiled and generated separately. Yes I am referring to the original blade.php file. Whats the best way to debug php variables in the compiled files then?
- I think PhpStorm has some issues with debugging actual compiled blade files (due to the way how files got named and how IDE works: such files have no extension and IDE is unable to associate them with
PHP filesfile type in order to be able to place breakpoints etc). Please refer to this ticket: youtrack.jetbrains.com/issue/WI-25835
- The blade syntax cannot be evaluated by the debugger (because the interpreter is implemented in Laravel). While PHPStorm does offer support for Blade templating to a certain extent, it cannot place breakpoins inside a
blade.phpfile unless the code is within
<?php ... ?>.
- Better look at this one: youtrack.jetbrains.com/issue/WI-26476
- wow - i just had a chance to use this and it works great - thanks Alex
- I found this trick works for debugging .thtml files in PHPstorm too. Thanks a lot!
- This same trick works in XDebug, using any IDE that supports it. I'm using it with UltraEdit Studio, although it should work in your favorite IDE, even my least favorite, Eclipse.
- Setting a break point might not be possible because they don't have
.phpextension. That is why I made a pull request for this: github.com/laravel/framework/pull/10462 - also the cache file name is not random - it is the md5 hash of the view file path.