This package is abandoned and no longer maintained. The author suggests using the michaelhall/coredump package instead.

Debugging tools for PHP

v1.0.0 2017-06-30 15:33 UTC

This package is auto-updated.

Last update: 2022-02-01 13:07:50 UTC


README

Build Status codecov.io Code Climate StyleCI License Latest Stable Version Total Downloads

Debugging tools for PHP

Requirements

  • PHP >= 7.1

Install with composer

$ composer require "michaelhall/debug:~1.0"

Basic usage

CoreDump class

<?php

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

// Creates a core dump and add some extra content.
// Globals like $_SERVER, $_GET, $_POST etc. are added automatically.
$coreDump = new \MichaelHall\Debug\CoreDump();
$coreDump->add('Foo', 'Bar');

// Writes the core dump.
echo $coreDump;

// Saves the core dump with an auto-generated file name in the current directory.
// Also returns the file name.
$coreDump->save();

// As above, but saves the core dump in the /tmp-directory.
$coreDump->save('/tmp');

VarDump class

<?php

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

$var = [
   1 => 'Foo',
];

// Writes:
// array[1]
// [
//   1 int => "Foo" string[3]
// ]
\MichaelHall\Debug\VarDump::write($var);

// As above, but instead assigns the result to a string.
$result = \MichaelHall\Debug\VarDump::toString($var);

License

MIT