PHP Classes
elePHPant
Icontem

PHP var_dump Pretty Class: Colored output values of variables to look pretty

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
2019-08-05 (2 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 34 This week: 34All time: 9,619 This week: 2Up
Version License PHP version Categories
dump7 1.0.0BSD License7HTML, Language, PHP 7
Description Author

This class can generated colored output values of variables to look pretty.

It can take the values of one or more variables and generates HTML output that presents the values of the variables in a nice way using colors to represent each data types value.

The class allows configuring the colors that are used to display each type of value.

  Performance   Level  
Name: chrys ugwu <contact>
Classes: 5 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 3x

 

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.

_Check out Dump5 for PHP 5+_

Installation

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

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

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 Dump(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:

# 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, [
    'foo' => 'bar',
    'bar' => 'foo',
    [
        'foo' => 'foobar',
        'bar_foo',
        2 => 'foo',
        'foo' => [
            'barbar' => 55,
            'foofoo' => false,
            'foobar' => null,
        ]
    ]
]);

CLI Windows output:

cli screenshot

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
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

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:34
All time:9,619
This week:2Up