pDebug Beta

A lightweight, powerful and robust debugging platform for PHP5

pDebug is one of those curiosities that you never bother polishing, I guess. It's called pDebug because I couldn't just call it Debug and I never bothered thinking of another name. It doesn't have JSON implemented because simply flicking it to text output mode made debugging JSON responses trivial anyway. It doesn't implement reflection because at the time reflection was horribly expensive and it doesn't really require it anyway. It's that kind of project.

But hey, it still does a hell of a lot and is kindof a pretty cool thing. I actually still use it, because it works on basically anything that can show a webpage and certainly anything that can print text. It works with any remotely modern installation of PHP because I made it originally on PHP 5.0.0. In fact I still have it in my php.ini's auto_prepend_file. The interface is snappy enough and gets mucked up by other page CSS infrequently enough that it 'does the job pretty well'.

It certainly taught me a lot about how languages work and how to do OO wrong. But a lot of the design decisions therein are in the interests of compatibility and not polluting the global namespace. So if it can be of use to you in some horrid restrictive test environment (for which you have my deepest sympathies), enjoy.

Completed feature
Under development
Potential feature, may be implemented


  • One-click integration between IDE » Local codebase » Browser » Server codebase

    • Available after a simple 1-time setup procedure on your development PC (running a .reg file & copying an .exe file... or your preferred method!)
    • Acts as a bridge between your IDE, webserver and codebases so that opening the cause of an error is as easy as clicking a link on a webpage
    • Universally implemented across all pDebug components for all URI types
  • Error handler

    • Detailed error output with more information than standard PHP errors (regular expression compile warnings, json decoder errors and more...)
    • Option to log notices / strict warnings like the default PHP error handler in strict mode
    • Handle thrown exceptions, and display variables in scope
    • Output mode stream flags
      • Ability to define & toggle debugger / error handler behaviour for various build conditions (debug, release etc)
        • Output in stream (default true)
        • Output to error / log file (default true)
          • Uses default PHP error log for output if specified
            (thus, it replaces the inbuilt error handler completely! *except for parser & core errors
        • Send output to email address (default false)
        • Output to redirected stream (multiple possible simultaneously)- any PHP stream resource: file, process, socket etc
    • options to set emailing and / or output of errors & debug output
  • Debugger

    • Lightning fast, stable, enterprise tested debug engine with detailed output superior to PHP's built-in print_r().
    • Extended object debugging
      • Makes use of PHP5 reflection classes & interfaces to generate detailed debug output, including:
        • ... whatever the language is capable of...
      • Linkage for recursed members within arrays & objects (using anchors in HTML, reference IDs in plaintext)
    • Improved string debugging:
      • Multiline strings
        • Display as collapsible nodes similar to Arrays, Objects etc
        • Displayed with line numbers
        • Scrolling ouput panel for long lines
        • Toggle line numbers in HTML view
      • Line ending match regular expression now as a config var
      • Truncation in function parameter output
      • Option to highlight PHP code in output
      • Option to highlight JS / CSS blocks in output
      • Option to link and output file contents for detected file paths
    • Full debugging for common resource types
      • With specific attention to:
        • mysql link
          • Output of database link status information
          • Outputs entire database schema
        • mysql result
          • Output full resultset
            • In scrolling panel for long or multiline strings
          • Column datatype detection & display, using current DB connection (when possible)
      • Minimal loading overhead: resource type output logic is stored in external function includes
      • Implement support for all built-in resource types
    • Utility method to measure execution time of every line in a file
  • Benchmarker

    • Intelligent debugger that adjusts for internal function calls and outputs statistics for internal execution times
    • Dump variables in a benchmark call as extra parameters to be used like dump();
    • Benchmark data can be used in external scripts, and is compatible with memory_get_usage(); and microtime(true);
    • Color shading (green » red, for example) for memory & time usage
  • Stack trace

    • Expandable properties for calling objects in stack
      • Shows object state at each point in execution
    • ‘Compressed mode’ variable view for stack trace function parameters
  • Themeable display with multiple output modes

    • Fully styleable themes via simple configuration utilising wildcards & css
    • Automatic detection of required output mode based on script execution type. Supports:
      • HTML, in-browser, instant output
      • JSON for AJAX / Firebug (using HTML mode for common functions etc)
      • Plaintext
        • CLI mode
        • Socket request
        • ...
      • Prototype
      • FirePHP
      • MooTools
      • ExtJS
      • ...
    • Output deferred to script end, to avoid messing with scripts that depend on headers etc
    • XHTML
      • For instant, realtime page / script output using plain HTML
      • Totally customisable output using CSS & HTML
        • Default theme (only fully compatible with Firefox) features advanced options:
          • Output (variable / stack etc) node toggling / compression
          • ...
        • Fallback to “plaintext in <pre>” output for ancient browsers
        • Other theme options, compatible with other browsers...
    • Plaintext
      • For use in text browsers, CLI scripts, socket querying or any other application with limited output capabilities
      • (NOTE: I actually have just used this with JSON output since forever - it breaks response interpretation but is quite readable)
    • JSON
      • For use in asynchronous server calls, AJAX applications etc
      • JSON data handling functions to collect & display debug data
        • Automatically executing response handler
        • Debugging output deferred until page load, or displayed in time with asynchronous server requests (AJAX)
    • FirePHP compatible output theme
    • Ability to force any output mode to use any other element's output type
  • Simplified integration - single include is all that is required
  • Easy-to-edit configuration file
  • Rock solid codebase tested in an enterprise level system