Debugging PHP

Debugging PHP has always been a pita1. Back in the day, people went with Xdebug and still seem to do so. Once setup properly (this is where the nightmare starts btw) it never felt right to use, halt execution with breakpoints and rely on the decent capabilities of your IDE. Long story short, it was a mess to configure the setup and still is.

These days I got used to Symfony’s var dumper or cowboy debug on my own. Thus I got very comfy when I read about PHP Console the other day. The setup is quite simple. All it needs is an extension in your browser and the server library as dependency. The latter can also be satisfied with plugins available for various content management systems, so it won’t get any easier. This way I can debug the output in the browser console or even use notifications2.

There are still some situations I can’t use the method above though. This is usually the case when I would like to inspect requests from anything other than a browser. But that’s nothing a simple log file with tail -f can’t solve.

Footnotes:

1

pain in the ass

2

thanks to the Notifications API