2017 © Pedro Peláez
 

library dumpdump

PHP var_dump like a boss.

image

jewei/dumpdump

PHP var_dump like a boss.

  • Friday, March 18, 2016
  • by jewei
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

dumpdump

PHP var dump to file., (*1)

Sometimes you cannot echo'<pre>';var_dump($var);die; to send debug info to the browser window. Especially during AJAX request or cron run. In such cases, you can send the debug info to a separate channel, plain file. Imagine now you can use console to tail -f debug.txt., (*2)

This is not a full-fledge debugger. If you're looking for one, you may want to check these out:, (*3)

Installation

Install globally via Composer.

composer global require jewei/dumpdump

Add to php.ini so PHP can autoload., (*4)

auto_prepend_file = ${HOME}/.composer/vendor/autoload.php

Use the Git repository.

Git clone this repository and require '/path/to/src/Dump.php';., (*5)

Usage

<?php
// /path/to/your/file.php

// If not installed globally, load it locally.
require __DIR__.'/vendor/autoload.php';

use Jewei\DumpDump\Dump;

// Var dump like a boss.
Dump::dump('hello', 'make this id 789');

// Dump using function.
$var = array('some', 'data', 'you', 'want', 'to', 'see');
dumpdump($var, 'this is optional id of coz');

Generated output:, (*6)

[make this id 789]
Fri, 18 Mar 2016 16:16:53 +0800
/path/to/your/file.php dump:10
--------------------------------------------------------------------------------
string 'hello' (length=5)
--------------------------------------------------------------------------------

[this is optional id of coz]
Fri, 18 Mar 2016 16:16:53 +0800
/path/to/your/file.php dumpdump:14
--------------------------------------------------------------------------------

array (size=6)
  0 => string 'some' (length=4)
  1 => string 'data' (length=4)
  2 => string 'you' (length=3)
  3 => string 'want' (length=4)
  4 => string 'to' (length=2)
  5 => string 'see' (length=3)
--------------------------------------------------------------------------------

Configuration

Copy config.json.dist to config.json., (*7)

{
    "file_name":"debug.txt",
    "display_time":true,
    "time_format":"r"
}

Edit the config value and save it., (*8)

filename - The file path where the output goes to.
display_time - Boolean show or no.
time_format - Accept PHP date() format.

The Versions

18/03 2016

dev-master

9999999-dev

PHP var_dump like a boss.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jewei Mak

18/03 2016

1.0.1

1.0.1.0

PHP var_dump like a boss.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jewei Mak

17/03 2016

1.0.0

1.0.0.0

PHP var_dump like a boss.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Jewei Mak