dev-master
9999999-dev https://github.com/MrLunar/php-dbg-dumperA lightweight PHP variable dumper, including the variable (or expression) name itself.
Unlicense
by Mark Bowker
debug variable dump print dumper backtrace
A lightweight PHP variable dumper, including the variable (or expression) name itself.
A prettified PHP variable dumper. Outputs nicely to the browser and CLI (included piped output). Does not replace var_export
or print_r
, but merely acts a wrapper to these core PHP functions., (*1)
For each argument provided, it spits out the file name, line number, variable type, variable name and value. The output always displays nicely even if through a browser, a terminal or even piped into less
or into a file., (*2)
The unique selling point here is the output of the variable name or the given expression. This gives quick visibility of many variables at once (rather than trying to remember which order you dumped your vars)., (*3)
Create a composer.json file for your project, and include the following:, (*4)
{ "require": { "mrlunar/php-dbg-dumper": "dev-master" } }
The following code:, (*5)
$my_var = array('my array var'); dbg::print_r($my_var);
would output in the browser like so:, (*6)
, (*7)
yet would output in the terminal like so:, (*8)
, (*9)
Also for example, the expression:, (*10)
dbg::print_r(rand(1, 50));
would output to the browser:, (*11)
, (*12)
dbg::var_export($my_var);
Same as dbg::print_r($my_var);
but using PHP's var_export()
output., (*13)
dbg::quit();
A verbose exit() so you don't lose yourself in a whitescreen., (*14)
, (*15)
dbg::error('a terrible error has occured, run for the hills'); dbg::warning('just an FYI because this will probably cause problems later'); dbg::info('I just want to talk');
Should you feel these are useful in your scripts:, (*16)
, (*17)
dbg::dump($my_var);
Experimental. Like dbg::print_r()
but outputs arrays and objects into a tabular format., (*18)
A lightweight PHP variable dumper, including the variable (or expression) name itself.
Unlicense
debug variable dump print dumper backtrace