Debug your Laravel Application on PhpStrom
Debugging is the key concept while we writing thousands of lines in code. In most of the cases, developers set the breakpoints and test the code it is work as expected.
In PHP framework like laravel, normally we are using var_dump(), echo and dd command to see the values. But do you think it is a proper way to debug?
In this session, I give you some few steps to debug your laravel applications using PhpStrom and Xdebug. Just follow the step one by one.
Download the Xdebug and Configure with your PHP installation
Go to the Xdebug download page and download the proper version of xdebug of your PHP version. If you find difficult to find the correct version of Xdebug better go to custom installation instructions link on the same page.
If you click the custom installation page follow the instruction to install Xdebug and configure it.
After that install the browser extension for Xdebug.
|Internet Explorer||PhpStorm bookmarklets generator|
Connect PhpStrom and Xdebug
After you finish the installation, Start your laravel project by entering the following command
php artisan serve
then go to your browser and check it. your application is run without the debugger.
Example: http://localhost:8000 will show your welcome page.
After that in your browser click, the bug button appears on your web page and click Debug. Then the button appears as green.
Then, go to your PhpStrom and click the button
and it will show up as
It means the PhpStrom is listening the debugging session of the browser.
Then setting the break point on your code and refresh the page. You will point to the breakpoint when your code is triggered.