marmotz/dumper

A pretty variable dumper for HTML & cli

dev-master 2013-10-22 11:40 UTC

This package is auto-updated.

Last update: 2024-02-28 00:47:45 UTC


README

A pretty variable dumper for HTML & cli.

Build Status

Installation with composer

{
    "require": {
        "marmotz/dumper": "dev-master"
    }
}

In most of the cases you don't need Dumper in your production environment.

{
    "require-dev": {
        "marmotz/dumper": "dev-master"
    }
}

Usage

Include composer autoloader in your project and use dump() function.

require_once __DIR__ . '/vendor/autoload.php';

dump($_SERVER);

Configuration

You can limit the depth of the dump by using setMaxLevelOfRecursion function like this:

Marmotz\Dumper\Dump::setMaxLevelOfRecursion(5);

Output

Dumper self-determines output type between HTML and cli.

With following code:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$array = array(
    1, 2, fopen(__FILE__, 'r'),
    uniqid() => array(
        4,
        array(
            uniqid() => 5, 'foobar'
        ),
        7
    ),
    8 => new stdClass
);

dump($array, new DateTime);

CLI

Here is an example of cli output: http://asciinema.org/a/5706

HTML

Here is an example of HTML output:

HTML Dump