PHP Classes
elePHPant
Icontem

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    
Last Updated Ratings Unique User Downloads Download Rankings
2017-11-10 (1 month ago) RSS 2.0 feedStarStarStar 42%Total: 381 This week: 1All time: 6,473 This week: 579Up
Version License PHP version Categories
pretty_data_dump 1.0.3BSD 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
  Performance   Level  
Name: chrys ugwu <contact>
Classes: 3 packages by
Country: Nigeria Nigeria
Age: 24
All time rank: 277313 in Nigeria Nigeria
Week rank: 207 Up3 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 2x

Details

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.

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:381
This week:1
All time:6,473
This week:579Up
User Ratings User Comments (1)
 All time
Utility:58%StarStarStar
Consistency:75%StarStarStarStar
Documentation:58%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:42%StarStarStar
Rank:2820
 
I have tested the standalone version (Dump5-1.
2 months ago (Alekos Psimikakis)
5%Star