PHP is a language easy to grasp, thanks to excellent documentation and code that is usually not a challenge to get through. However that is only half and other one is what goes on when PHP is working.
It is important to understand internals of variables and objects, at the same time native PHP functions for that are limited and have inconvenient output. Krumo is PHP class that dumps variables in the form of convenient foldable and skinnable tree.
What it does
Krumo is a static class that you include in PHP project and after that you can dump variables like:
Result is showed in a tree with juicy details on variable type, content, nesting and even exact place in code where call to Krumo was made.
It comes with several skins (can be changed by editing configuration file) so for them to work folder with Krumo should be web-accessible.
On top of dumping variables it also has number of static methods that display various session- and configuration-related information. Not all of them are described on home page so docs are where you should look for those.
Highly useful feature is that Krumo can be globally disabled with single method call. Much superior to jumping all over code, trying to add or remove debug lines.
One limitation, that may or may not be important, is that latest Krumo version only works with PHP 5. There are earlier versions available for download, if you really need it on PHP 4 stack.
One usability option I’d like to see is way to launch tree unfolded by default. For complex objects clicks through branches can add up fast.
Krumo seems to have inspired number of tools. One of those is WP-Devel plugin for WordPress that adds admin-only bar on top of page with extensive dynamic options to show information with bundled Krumo.
Basically it allows to browse good chunk of WordPress internal workings without having to write a single line of code.
Hadn’t been updated in a while, but still highly useful and open source PHP class that brings convenience and usability into dumping variables.
Kaloyan K. Tsvetkov #