2017 © Pedro Peláez
 

library php-dbg-dumper

A lightweight PHP variable dumper, including the variable (or expression) name itself.

image

mrlunar/php-dbg-dumper

A lightweight PHP variable dumper, including the variable (or expression) name itself.

  • Tuesday, February 25, 2014
  • by minimax
  • Repository
  • 2 Watchers
  • 1 Stars
  • 89 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

DBG Dumper

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)

About

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)

Install

Create a composer.json file for your project, and include the following:, (*4)

{
    "require": {
        "mrlunar/php-dbg-dumper": "dev-master"
    }
}

Examples

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)

Other Commands

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)

The Versions

25/02 2014

dev-master

9999999-dev https://github.com/MrLunar/php-dbg-dumper

A lightweight PHP variable dumper, including the variable (or expression) name itself.

  Sources   Download

Unlicense

by Mark Bowker

debug variable dump print dumper backtrace