Skip to content

Instantly share code, notes, and snippets.

@nicolas-grekas
Last active January 4, 2016 05:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolas-grekas/8578209 to your computer and use it in GitHub Desktop.
Save nicolas-grekas/8578209 to your computer and use it in GitHub Desktop.
Playing Patchwork CLI Color Dumper

Playing with Patchwork CLI color dumper

git clone https://gist.github.com/8578209.git try-patchwork-dumper
cd try-patchwork-dumper
composer install
php test-cli.php
<?php
class a
{
public $b = 'b';
protected $c = 'c';
private $d = 'd';
}
$g = opendir('.');
$h = opendir('.');
closedir($h);
$a = array(
'number' => 1, 1.1,
'const' => null, true, false, NAN, INF, -INF, PHP_INT_MAX,
'str' => "déjà", utf8_decode('déjà'),
'[]' => array(),
'res' => $g, $h,
'obj' => new a,
'nobj' => array(new a),
'closure' => function($a, \PDO &$b = null) {}, 'line' => __LINE__,
implode('', range("\0", "\x7F")) => implode('', range("\0", "\x7F")),
);
$r = array();
$r[] =& $r;
$a['recurs'] =& $r;
$a[] =& $a[0];
$a['sobj'] = $a['obj'];
$a['snobj'] =& $a['nobj'][0];
$a['snobj2'] = $a['nobj'][0];
{
"name": "nicolas-grekas/try-patchword-dumper",
"authors": [
{
"name": "Nicolas Grekas",
"email": "nicolas.grekas@gmail.com"
}
],
"require": {
"patchwork/error-logger": "dev-master@dev"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "7a01360a7e74eddcbb487298a6daa7c8",
"packages": [
{
"name": "patchwork/error-logger",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/nicolas-grekas/Patchwork-Error-Logger.git",
"reference": "3eeb649f05acb31eb03889e7cd7c77b0ed95bb20"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nicolas-grekas/Patchwork-Error-Logger/zipball/3eeb649f05acb31eb03889e7cd7c77b0ed95bb20",
"reference": "3eeb649f05acb31eb03889e7cd7c77b0ed95bb20",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Patchwork": "class/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"(Apache-2.0 or GPL-2.0)"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com",
"role": "Developer"
}
],
"description": "Advanced PHP error handling and high accuracy JSON logging",
"homepage": "https://github.com/nicolas-grekas/Patchwork-Error-Logger",
"keywords": [
"dump",
"error",
"exception",
"json",
"log",
"logging"
],
"time": "2014-01-30 09:35:16"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": {
"patchwork/error-logger": 20
},
"platform": [
],
"platform-dev": [
]
}
<?php
require __DIR__ . '/vendor/autoload.php';
use Patchwork\PHP\CliColorDumper as d;
require __DIR__ . '/a.php';
d::dump($a);
<?php
require __DIR__ . '/vendor/autoload.php';
use Patchwork\PHP\JsonDumper as d;
require __DIR__ . '/a.php';
d::dump($a);
<?php
require __DIR__ . '/a.php';
var_dump($a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment