Do you have any idea how to debug using docker https://github.com/laraedit/laraedit-docker ?
How To: Debug your laravel in VSCode!
Hi guys!
As yesterday i'd spend some time setin'up PHP debugging for Visual Studio Code, as all works fine by now, lets explain how to set this up!
As VSCode is still under development and many great add'ons are allready available, I think this is really a promissing compaditor for the text editors around, like Sublime and Atom.
*I'm under the OSX Env!
- You should download Visual Studio Code https://code.visualstudio.com/Download
- As Php7 is out now, we should upgrade to the latest version!
Note* that this took me like an hour, to upgrade there are like a dozen of tutotials out there that are just all different!
Get on with Homebrew and just follow this link: https://mhdzaherghaibeh.name/2015/12/26/how-tow-installing-php-7-on-mac/
At this stage it might be that your Homebrew breaks, Dont panic, just de-install Homebrew by using this script: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/FAQ.md#how-do-i-uninstall-homebrew and re-install with: http://brew.sh/
All set and done right? reboot your server and do a quick check if the php is really updated to 7 by simply: "php -v" in your teminal.
-
Lets get on and install, xDebug, the php extention that handles the debugging for php files :) As we have Homebrew installed, just brew it up by: brew install php70-xdebug , in your terminal.
-
Lets Config! Xdebug needs a bit of configuration, and lets refer to the documentation: https://xdebug.org/docs/install
We just setup a clean install for Php7, so your php.ini config file should be there somewere... code /usr/local/etc/php/7.0 -> open your ini file in VSCode add following rules: zend_extension = /path/to/your/xdebug.so -> find this by yourself xdebug.remote_enable = 1 xdebug.remote_connect_back=1 xdebug.remote_port = 8000 xdebug.scream=0 xdebug.show_local_vars=1
- Add plugin for Visual Studio to have PHP debugging compatibillity https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug Follow the docs and reboot VSC, you should be ready!
Get to your laravel application,-> go to debug -> set listen for debug (selectbox) and set your port to 8000 in the config.
Done! set breakpoint in your custom code. Run php artisan serve in your terminal -> lauches php server for localhost:8000. For xDebug to start append ONCE this query parameter "?XDEBUG_SESSION_START=15117" or some random number/string as value.
Have Fun!
Please or to participate in this conversation.