Guides > Debugger & Logger

Introducing The Debugger & Logger Component

The goal of this class is to ease the process of debugging php scripts. The class uses a floating panel at the top right of the page. There are also a couple of features that can fix security issues with the php default error handler. All class properties and methods are static because it's required to let them work on script shutdown when FATAL error occurs. Click here to show the interface!

Main Features:

  • Show globals vars ($GLOBALS, $_POST, $_GET, $_COOKIE ...)
  • Show php version and loaded extensions
  • Replace php built in error handler
  • Log sql queries
  • Monitor code and sql queries execution time
  • Inspect variables for changes
  • Function calls tracing
  • Code coverage analysis to check which lines of script where executed
  • Dump of all types of variable
  • File inspector with code highlighter to view source code
  • Send messages to js console(Chrome only), for ajax scripts

Getting Started

The class works right out of the box by calling the static method load().
Download PtcDebug.php from the repository and add the following 4 lines of code at the very start of your script or application:

  1. require_once('PtcDebug.php');
  2. $_GET['debug']=true;        // turn on the debug
  3. //$_GET['debug_off']=true;    // turn off debug
  4. PtcDebug::load();
That should get you started with the debugger.
For a complete list of options and more examples see the full user guide.

Wordpress Plugin

A wordpress plugin is also available for this class, it can be downloaded from this repository.
Visit the wiki section for example usage and installation.

**If you like this class, help the project to grow by rating or writing a review at one of the following sites:
Vote for us on Hot Scripts

⇑Back to Top⇑