2017 © Pedro Peláez
 

library error-dumper

Pretty errors and exceptions in PHP.

image

bkrukowski/error-dumper

Pretty errors and exceptions in PHP.

  • Saturday, February 18, 2017
  • by bkrukowski
  • Repository
  • 0 Watchers
  • 1 Stars
  • 989 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status Codacy Badge, (*1)

Pretty error dumper for PHP

ErrorDumper has been moved to awesomite/error-dumper, please use new repository., (*2)

Requirements

  • PHP >= 5.3 (also 7.0 is supported)
  • no dependencies
  • for nicer dump of variables you can add symfony/var-dumper to project

Tests

100% code coverage with PHPUnit., (*3)

Installation

If you use composer

Add bkrukowski/error-dumper to dependencies., (*4)

In other cases

Add below code to project:, (*5)

$pathToLib = 'here put path to error-dumper library';
include $pathToLib . 'src' . DIRECTORY_SEPARATOR . 'autoload.inc.php';

Usage

[Unsafe] Below code is enough:, (*6)

\ErrorDumper\Magic::registerErrorDumper();

[Safe] But you should write something like this (because all variables like credentials are visible, when exception or error occur), (*7)

if ($isInTestEnvironment)
{
    \ErrorDumper\Magic::registerErrorDumper();
}
else
{
    \ErrorDumper\Magic::registerErrorCallback(function ($e) {
        /** @var \Exception|\Throwable $e */
        // save error somewhere, for example:
        // $output = \ErrorDumper\Magic::exportExceptionToLightHtml($exception);
        // \Foo\MyErrorStorage::addHtmlError($output);
        exit(1);
    });
}

Editors

Numbers of lines and names of files are clickable, but you have to set proper editor. Default editor is PhpStorm. If you use something else, put edtor object as argument in registerErrorDumper method., (*8)

\ErrorDumper\Magic::registerErrorDumper(new \ErrorDumper\Editors\MacVim());

Supported editors

  • MacVim
  • PhpStorm
  • TextMate

Snapshots

Using below code, you can save exception somewhere and display it later:, (*9)

$output = \ErrorDumper\Magic::exportExceptionToLightHtml($exception);

Adding custom information to snapshots

From version 2.3.0 there is special constant ErrorDumper\Dumpers\Html::TAG_UNDER_TITLE. You can put under title whatever you want using str_replace function., (*10)

Handle only exceptions

You can choose type of errors to handling. Methods, (*11)

  • ErrorDumper\Magic::registerErrorDumper
  • ErrorDumper\Magic::registerErrorCallback
  • ErrorDumper\Handlers\RegisterErrorHandler::register

have optional argument $errorTypes, default is equal ErrorDumper\Handlers\RegisterErrorHandler::TYPE_ALL. This value is equal result of binary multiplication of constants ErrorDumper\Handlers\RegisterErrorHandler::TYPE_*. If you want handle only errors, you should put here ErrorDumper\Handlers\RegisterErrorHandler::TYPE_ERRORS | ErrorDumper\Handlers\RegisterErrorHandler::TYPE_SHUTDOWN_ERRORS., (*12)

Preview

Error

Preview exception, (*13)

Arguments

Preview arguments, (*14)

The Versions

18/02 2017

dev-master

9999999-dev

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

27/11 2016

v2.6.4

2.6.4.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

22/08 2016

v2.6.3

2.6.3.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

21/08 2016

v2.6.2

2.6.2.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

19/08 2016

v2.6.1

2.6.1.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

16/08 2016

v2.6.0

2.6.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3 || ^7.0

 

The Development Requires

by Bartłomiej Krukowski

debug errors utility exceptions

06/05 2016

v2.5.2

2.5.2.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0

 

The Development Requires

by Bartłomiej Krukowski

10/03 2016

v2.5.1

2.5.1.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

10/03 2016

v2.5.0

2.5.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

28/02 2016

v2.4.0

2.4.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

25/02 2016

v2.3.0

2.3.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Bartłomiej Krukowski

25/02 2016

v2.2.5

2.2.5.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Bartłomiej Krukowski

23/02 2016

v2.2.4

2.2.4.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

by Bartłomiej Krukowski

09/02 2016

v2.2.3

2.2.3.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

28/12 2015

v2.2.2

2.2.2.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

01/12 2015

v2.2.1

2.2.1.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

01/12 2015

v2.2.0

2.2.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

28/11 2015

v2.1.1

2.1.1.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

28/11 2015

v2.1.0

2.1.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

27/11 2015

v2.0.0

2.0.0.0

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski

13/11 2015

v1.0.0-alpha

1.0.0.0-alpha

Pretty errors and exceptions in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Bartłomiej Krukowski