Krumo: version 2.0 of print_r(); and var_dump();


To put it simply, Krumo is a replacement for print_r() and var_dump(). By definition Krumo is a debugging tool which displays structured information about any PHP variable.

A lot of developers use print_r() and var_dump() in the means of debugging tools. Although they were intended to present human readble information about a variable, we can all agree that in general they are not. Krumo is an alternative: it does the same job, but it presents the information beautified using HTML, CSS and JS.

Except the collapsible tree built around the structure of the dumped PHP variable, and the improved by the CSS looks, Krumo offers additional useful features.

For example haven't you been disappointed that you can not see the name of the variable passed for dumping ? Calling it many times, you will not be able to know which dump value was provided by a certain variable at a certain time in a certain place of your code. Well, Krumo can not do that either, but it offers a work-around: it prints the code line that the Krumo call was placed: in this way you can keep track of the origin of each dump you see on the screen.

Another nice addition to the set of Krumo features is the ability to turn it off. When your code gets swamped with a lot of dumping calls, instead of cleaning them up, you can just turn them off. You go to admit that this beats the alternative of going through your code and removing every dumping route you have ... right ?

A lot of times you need to dump the contents of the superglobals ($_GET, $_POST, $_SERVER, $_SESSION, etc), or see the list of included files, or the declared classes and interfaces, or the defined constants, etc. Krumo offers an easy, fast and graceful way to do this with just one simple call: see the examples area for demonstration, or just load this page to see the results.

^ back to the top of the page


Two ways to do this:

  • The old-fashioned way: in order to use Krumo you have to put it on your (development) server, and include it in your script. You can put it somewhere in the INCLUDE_PATH, or specify the full path to the class.krumo.php file.

  • The modern way: use Composer. You can either install Krumo like this:
     php composer.phar install kktsvetkov/krumo

And that's it - you can use it out of the box. If you want to change the "skin" used to render the resuls, you have to modify the krumo::$skin property.

 krumo::$skin = 'orange';

The value for this setting has to be the name of one of the sub-folders from the Krumo/skins/ folder. If the value provided for the skin results in not finding the skin, the default skin will be used instead.

All the CSS files ("skin.css") from the Krumo/skins sub-folders must have the proper permissions in order to be readable from Krumo.

^ back to the top of the page


Here's a basic PHP example, which will return a report on the array variable passed as argument to it:

 krumo(array('a1'=> 'A1', 3, 'red'));

You can dump simultaneously more then one variable - here's another PHP example:

 krumo($_SERVER, $_ENV);

You probably saw from the PHP examples above that some of the nodes are expandable, so if you want to inspect the nested information, click on them and they will expand; if you do not need that information shown simply click again on it to collapse it. Here's a PHP example to test this:

 $x1->x2->x3->x4->x5->x6->x7->x8->x9 = 'X10';
  • krumo($x1); (Object) stdClass
  • Krumo version 0.4
    Called from /home/kt/krumo/index.php, line 180  

The krumo() is the only standalone PHP function from the package, and this is because basic dumps about variables (like print_r() or var_dump()) are the most common tasks such functionality is used for. The rest of the functionality can be called using static calls to the Krumo class. Here are several more PHP examples:

 // print a debug backgrace

 // print all the included(or required) files

 // print all the included functions

 // print all the declared classes

 // print all the defined constants

... and so on, etc.

To see a PHP demonstration of most features, click here.

Another handy feature is that you can enable and disable Krumo no the fly.

 // disable Krumo

 // Krumo is disabled, nothing is printed

 // enable Krumo

 // Krumo is enable, printing is OK

This proves to be very useful when your PHP code gets swamped with Krumo calls dumping debuging information, and instead of removing each of those dumps one by one, you can just disable them.

^ back to the top of the page


There are several skins pre-installed with this package, but if you wish you can create skins of your own. The skins are simply CSS files that are prepended to the result that Krumo prints. If you want to use images in your CSS (for background, list-style, etc), you have to use data URIs to embed them into the CSS.

Here's an example:

 background-image: url(data:image/gif;base64,R0lGODlhCQAJALMAAP///wAAAP///wAA...AJAAkAAAQTEIAna33USpwt79vncRpZgpcGRAA7);

Right now there are 4 Krumo skins (click on each to see a screenshot): default, blue, green, orange and the latest -

Feel free to contribute any new skins that you create on your own. Krumo is designed to present the PHP variable dumps in a nice and graceful way, so polishing its looks with new themes is a very important task.

^ back to the top of the page


To browse the site copy of Krumo docs, click here.

^ back to the top of the page


You can dowbload the latest relese of Krumo from the project's download page at

^ back to the top of the page

Bug Tracker

For the Krumo project, please use the GitHub project page to report issues. If you want to report a bug, request a new feature, or you have ideas about improving the framework, use the link below:

^ back to the top of the page


As with the bugs, please use

^ back to the top of the page
Krumo: Version 2.0 of print_r(); and var_dump();