📜 ⬆️ ⬇️

DumPHPer - Advanced PHP var dumper or var_dump replacement

Probably everyone has ever had to use the built-in functions of var_dump or print_r . It is extremely inconvenient to use them, for reading the dump it was necessary either to frame the calls of these functions with the <pre> tag or to watch the source code of the page. Moreover, print_r does not provide information about the type of variables, and var_dump has not so long been hanging on the output of recursive arrays. Therefore, I decided to write my own dumper, which would repeat everything that the above described functions can do, and also add additional information about objects and their properties and make the dump easy to read / learn.


Recently, I thought, why not share the code with the public. I'm a lazy person, so for a long time I didn’t undertake to rewrite the code (the old code was “smelly”), and in order to write an article you need to have time and desire. I have not yet found the time to create a project page on my site, as well as to create the site itself, all because of the same Leni.

What is already working

- actually dump
- color lights types
- folding / expanding arrays / objects
- definition of recursion of arrays / objects
- within one call, only the first mention of a specific instance of the object is dumped, when the instance is found again, a reference is made to its first mention, which, when clicked, finds and opens it
- consists only of itself
')

What's in the plans

- enter instances miscalculation for arrays (with functionality similar to objects), with the possibility of disabling this resource-intensive operation.

Known bugs

- in PHP 5.2 displays copies of non-public properties of the object (there are no ideas how to fix this, because they are obtained by converting to an array).

A brief demonstration is available at widowmaker.kiev.ua/dumper.html

Download the source from Google code



Instead of PS

0. Need such a thing?
1. What license will you advise?
2. What is the best way to fix the code (I don’t like the code), but so that there are no hundreds of objects?
3. Move to a PHP blog?
4. Ideas how to fix the bug, suggestions and criticism are welcome.

Update
I understand minus due to the fact that it is not described "why?". I will answer: then, that it is not always possible to put a module for debug (for example, no ssh), and this script is written in php, and you can simply upload it via FTP.

Source: https://habr.com/ru/post/80431/


All Articles