MAMP.ONE

web publishing magazine

MAMP PRO —
Xdebug with Visual Studio Code

If you work quite often with PHP, you will soon notice that debugging with the functions print_r() and var_dump() is quite difficult and do not always lead to the target. For this reason there is the PHP extension Xdebug. This PHP extension is already integrated into MAMP PRO and you only have to activate it by clicking a checkbox.

Now all that is missing is a nice visual presentation of the data provided by Xdebug. For example, you can use Visual Studio Code (VSC). For this editor there is an excellent extension “PHP Debug” by Felix Becker. To install, simply open the extension view in VSC and search for “PHP Debug”, click on the green “Install” button and your environment is ready.

Now you are not only informed about errors you made during programming, but you can also examine all variables and their values during the runtime of your PHP program by setting breakpoints. Only in this way it is possible to develop websites efficiently and professionally with PHP.