PHP Classes

Prettify PHP var_dump: Output variable values in a colorized way

Recommend this page to a friend!
  Info   View files Documentation   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 417 All time: 6,420 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: 30
All time rank: 16897 in Nigeria Nigeria
Week rank: 411 Up10 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  
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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:417
This week:0
All time:6,420
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:2798
 
I have tested the standalone version (Dump5-1.
6 years ago (Alekos Psimikakis)
5%Star