Tools
Last updated
Last updated
Debugging tools fall into two categories:
Tools to diagnose issues when they arise and reveal problems
Tools that prevent mistakes and errors from ever happening to begin with
The age old adage still applies: prevention is better than cure
Installing the plugin from the WordPress repository will give you quick access to a broad range of debugging tools. The following debugging plugins are quite useful:
Logs usage of deprecated functions.
Provides an interface for debugging PHP Notices/Warnings/Errors, reviewing SQL Queries, analysing caching behaviour and much more. It's also extendable with plugins.
The Debug Console for example is really useful.
View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
The PHP Extension allows for enhanced debugging, function and method tracing, and profiling of PHP applications. This is .
With , you can install a browser extension to access Xdebug (or ) from within the IDE.
Rather than manually adding var_dump
statements and reloading the page, you can add a breakpoint anywhere in your PHP code, execution will stop and you can see a stack trace, inspect (and modify) the values of all variables and objects or manually evaluate (test) a PHP expression.
With (controlled via cookies and bookmarklets) you don't need to add ?XDEBUG_SESSION_START
to your URLs and you can also debug HTTP post requests.
There are a number of tools dedicated to analysing code and catching semantic mistakes, or pointing out problems in code.
- PHP Debugger and Profiler
for Google Chrome
for Mozilla Firefox
for Internet Explorer
for Opera
for example, will highlight long variable names, npath and cyclomatic complexity, classes that are too large, unused variables, and other problems. is a tool provided by Facebook, and performs similar checks, such as finding dead statements and unused classes.
If you can't type hint, you can make use of a tool such as to infer types and find clashes. Many others exist though, and integrate with your editor/IDE, so look around