PHP Classes

Prettify PHP var_dump: Output variable values in a colorized way

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 417 All time: 6,426 This week: 571Up
Version License PHP version Categories
pretty_data_dump 1.0.4BSD License5.3PHP 5, Debug, Console
Description 

Author

This class can output variable values in a colorized way.

It can take a variable value and output HTML to displays it like the PHP var_dump function but highlights with colors different types of value.

For objects and arrays it traverses the contained elements recursively.

The class can also output variable values to a console as text without colors.

Innovation Award
PHP Programming Innovation award nominee
July 2017
Number 2
PHP provides nice functions to dump the type and values of a variables like var_dump and var_export.

This package provides an enhanced version of the var_dump function by colorizing the different values according their types.

Manuel Lemos
Picture of chrys ugwu
  Performance   Level  
Name: chrys ugwu <contact>
Classes: 16 packages by
Country: Nigeria Nigeria
Age: 31
All time rank: 16807 in Nigeria Nigeria
Week rank: 215 Up8 in Nigeria Nigeria Down
Innovation award
Innovation award
Nominee: 4x

Documentation

Pretty Data Dump

A pretty version of php var_dump. This class displays structured information about one or more expressions that includes its type and value.

_Check out Dump7 for PHP 7+_

Installation

You can download the Latest release version as a standalone, alternatively you can use Composer

$ composer require ghostff/dump5
"require": {
    "ghostff/dump5": "^1.0"
}

class Foo
{
    private $string = 'string';
    protected $int = 10;
    public $array = array(
        'foo'   => 'bar'
    );
    protected static $bool = false;
}

$string = 'Foobar';
$array = array('foo', 'bar');
$int = 327626;
$double = 22.223;
$null = null;
$bool = true;

new Dump(new Foo, $string, $array, $int, $double, $null, $bool, array(
    'foo' => 'bar',
    'bar' => 'foo',
    array(
        'foo' => 'foobar',
        'bar_foo',
        2 => 'foo',
        'foo' => array(
            'barbar' => 55,
            'foofoo' => false,
            'foobar' => null,
        )
    )
));

new Dump(1 == '1', 1 === '1');

Replacing predefined colors:

# set($name, [$cgi_color, $cli_color]);
Dump::set('boolean', ['bb02ff', 'purple']);

CGI output:

cgi screenshot

CLI Posix output:


cli screenshot

Windows user who are using command line tools like cmder can use the Dump::d method:

Dump::d(new Foo, $string, $array, $int, $double, $null, $bool, array(
    'foo' => 'bar',
    'bar' => 'foo',
    array(
        'foo' => 'foobar',
        'bar_foo',
        2 => 'foo',
        'foo' => array(
            'barbar' => 55,
            'foofoo' => false,
            'foobar' => null,
        )
    )
));

CLI Windows output:

cli screenshot


  Files folder image Files (6)  
File Role Description
Image file cgi.png Data Auxiliary data
Plain text file composer.json Data Auxiliary data
Plain text file LICENSE Lic. License text
Image file posix.png Data Auxiliary data
Image file posixWin.png Data Auxiliary data
Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:417
This week:0
All time:6,426
This week:571Up
User Ratings User Comments (1)
 All time
Utility:68%StarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:68%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:49%StarStarStar
Rank:2843
 
I have tested the standalone version (Dump5-1.
6 years ago (Alekos Psimikakis)
5%Star