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 (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-07-11 (1 month ago) RSS 2.0 feedNot enough user ratingsTotal: 335 This week: 9All time: 6,827 This week: 64Up
Version License PHP version Categories
pretty_data_dump 1.0.2BSD 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
Nominee
Vote
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: 294714 in Nigeria Nigeria
Week rank: 36 Up2 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.

Dump implementation in 5.3 is a bit different from 7.0. All new functionality and fixes are implemented on 7.1 though some might be extended to 5.3.

Installation

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

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

Usage

new Dump7(...); # For PHP 7+
new Dump5(...); # For PHP 5+


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

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


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

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

Replacing predefined colors:

Dump5::set('bool', 'F00');
new Dump5(false, true);

CGI output:

cgi screenshot

CLI output:


cli screenshot

  Files folder image Files  
File Role Description
Files folder imagesrc (2 directories)
Image file cgi.png Data Auxiliary data
Image file cli.png Data Auxiliary data
Plain text file composer.json Data Auxiliary data
Plain text file LICENSE Lic. License text
Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagePHP5 (1 file)
Files folder imagePHP7 (1 file)

  Files folder image Files  /  src  /  PHP5  
File Role Description
  Plain text file Dump.php Class Class source

  Files folder image Files  /  src  /  PHP7  
File Role Description
  Plain text file Dump.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:335
This week:9
All time:6,827
This week:64Up