Giter VIP home page Giter VIP logo

dump5's Introduction

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"
}

Display Flags

You can simple hide or show some object attribute using a Doc block flag:

@dumpignore-inheritance Hides inherited class properties.
@dumpignore-inherited-class Hides the class name from inherited properties.
@dumpignore-private Show all properties except the private ones.
@dumpignore-protected Show all properties except the protected ones.
@dumpignore-public Show all properties except the public ones.
@dumpignore Hide the property the Doc comment belongs to.
/**
* @dumpignore-inheritance
* @dumpignore-inherited-class
* @dumpignore-private
* @dumpignore-public
* @dumpignore-public
*/
Class Foo extends Bar {
    /** @dumpignore */
    public $big_object = null;
}

Usage

class FooBar
{
    private $inherited_int   = 123;
    private $inherited_array = array('string');
}

class Bar extends FooBar
{
    private $inherited_float = 0.22;
    private $inherited_bool  = true;
}

class Foo extends Bar
{
    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;
$resource = fopen('LICENSE', 'r');
$m        = microtime(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,

        )
    )
), $resource);

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

Replacing predefined colors:

# set($name, [$cgi_color, $cli_color]);
Dump::set('boolean', array('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

dump5's People

Contributors

ghostff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dump5's Issues

Duplicate

Why would you do this, isn't for example symfony/var-dumper better?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.