#StandWithUkraine

Ease PHP (WP as well) learning and debug with Krumo

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:

krumo($variable);

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.

krumo_interface

It comes with several skins (can be changed by editing configuration file) so for them to work folder with Krumo should be web-accessible.

Strong features

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.

Downsides

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.

For WordPress

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.

Overall

Hadn’t been updated in a while, but still highly useful and open source PHP class that brings convenience and usability into dumping variables.

Home http://kaloyan.info/krumo/index.php

Download http://sourceforge.net/projects/krumo/files/

Related Posts

4 Comments

  • Ishan@ILoveFreeSoftware #

    Nice.. I will keep this handy when (and if) I start doing deep dive in PHP :)
  • Rarst #

    @Ishan For me it sees a lot of use even if going shallow. :)
  • Kaloyan K. Tsvetkov #

    Hi, I am the developer of Krumo, and I just wanted to thank you for the kind words about my project.
  • Rarst #

    @Kaloyan K. Tsvetkov Thank you for developing it! Good visualization greatly improves how fast and accurately data can be consumed. :)