This debugger started as a simple development helper function for my hobby work in 2005. Its only task was to simplify the call of print_r in an HTML readable layout like this:

echo "

It wrote a simple red box directly into the current output of your html document, with nothing more then this print_r result and a click-able caption to collapse or expand this message to save space.

Hello world!

Here is the code:

function __debug($v){
	$id = "info".md5(microtime(1));
	$styleSpan = "color: red; cursor: pointer; font-size: xx-small;";
	$stylePre = "position: relative; z-index: 1; left: 0px; top: 0px; background: white; border: 1px solid red; cursor: default; text-align: left;";
	$v = htmlspecialchars(print_r($v,true));
	#if(empty($v)) $v = "EMPTY";
	echo "<__debug>"
"; }

Since then, this function had a lot of new revisions and has grown to be a useful tool now – as I try to describe in the next chapters. I hope you enjoy this piece of history and excuse my poor or pragmatic programming style at this time, but always remember: it was only a development helper function for me, not for the public!

Have fun!

Some steps beyond in 2007

Different projects required different debugging methods. The debugger was extended by a brand new graphical interface to make it more easier to understand for the developer where he is in the code and what he is debugging!

New features were added for each needed case, the printed variable was extended by informations about her type and size. The debug backtrace function was used to show the file and line where it was called and two buttons on the top of the new drag able debug window hold the current IP address of the server and client.

Every debug message in the window got an own title, type color and cookie to save his state of display, but the cookie limit of the browsers were reached fast. It was enough for the first moment, but not practicable for long time or any public use. Anyway, the abilities of the new window were very useful because of the seamless layout integration and the position restoring.

basic version in 2007

A command line output handler was also added to debug cronjob scripts.

extended version in 2007

But the next big step followed in the year after.

Spreading ideas in 2008

The project had a constant growing in the past, but every new feature required something like a prototype. So the debug file was extended by other useful functions like __class to print detailed informations of an class and their parents. Other functions helped to search through the $GLOBALS array for values or keys. An proprietary error handler was also added for the debugger, but it was not really useful at this time.


Download proprietary version with prototypes

This version was far away from any productive stadium, and a complete redesign of the function was required to solve the challenge to integrate all the functionalities into simply one function. It needed an half year to do so, and the result was something like a new prototype of this all-in-one debugging concept. But the changes where worth to had a look for:

And that was the new window design:

the new redesign
Download redesigned version (alpha)

Finally, the version was pushed from a development version number to a first version 1.0 in alpha state, three years after the first prototype.

2009 keep on rolling

The daily work brought many new ideas to the project and the debugger had to fulfill a lot of different requirements. It was the year of fine tuning, the features where tested in many environments and use-cases. The debugger earned a fixed place in the development process of many projects and the software quality increased permanently.

Performance was a big point for that area, because every debugging output was append to the website source code and reached different browser or server limits sometimes. The debugger learned to respect his environment and reduced his output if necessary. Even the HTML, JavaScript and CSS elements were downsized to a reasonable scale.

More and more information's where removed from the default output and loaded when possible on demand from the server. This was a big advantage in compare to send every information to the user again and again, no matter if he really wants them.

The challenge to keep everything we need in one file for (really easy installations) required some new solutions to merge different file types together. Text based files where no big deal, but the use of images should be another great milestone inspired by the classic mime mails. They encode binary data with base64 and this allows us to store even image data as utf-8 compatible string. Finally a new animated icon was added with only 6kb written over 74 lines in the debuggers file to visualize background processes.

Configuration of the debugger was quite simple now. Once you activated the debug mode a configuration interface just through the existing function was established. A simple __debug('10%','config:maxMemory'); call told the debugger that he could use up to 10% of the available memory for his own data. This was very important to prevent memory limit exceeding, when the running PHP application needed a lot of memory.

xn.debug - free & easy - open sourceTo make the use of this tool even more comfortable, a documentation section was added with useful hints and tips to support the developer. The nifty trick was to extract the already existing source code documentation from the debugger file itself and bring it to the front client.

The debugger grows each day and the time feels ready to see the daylight. It is something like a proof of concept and this tool is ready to go into beta state. I hope it will help many people by their work and so I released it as an open source project in 2010.

The time has come, to overwork the whole idea and start work on version 2.0 in the hope that the open source community brings in their ideas, experiences and knowledge to build a next generation of debugging tools without the need of third party libraries.