2017 © Pedro Peláez
 

library laravel-pretty-errors

Error formatter for Laravel.

image

peraleks/laravel-pretty-errors

Error formatter for Laravel.

  • Friday, March 31, 2017
  • by peraleks
  • Repository
  • 1 Watchers
  • 6 Stars
  • 692 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 12 % Grown

The README.md

Total Downloads Latest Stable Version License, (*1)

LaravelPrettyErrors

Error formatter for Laravel 5.1 or later. Provides a convenient display as HTML-page and in the browser console. Provides an enhanced view of the stack trace (viewing the contents of the arguments: array, closure, resource, string; and view PHPDoc classes and methods). Provides the opportunity to configure custom pages 404 and 500., (*2)

, (*3)

Install

$ composer require peraleks/laravel-pretty-errors

Usage

Copy file vendor/peraleks/laravel-pretty-errors/src/Config/pretty-errors.php to Laravel config_path (app/config)., (*4)

Add code to App\Exceptions\Handler :, (*5)

use Peraleks\LaravelPrettyErrors\Core\PrettyHandler;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;


    protected function convertExceptionToResponse(Exception $e)
    {
        $html = PrettyHandler::format($e, config_path('pretty-errors.php'));

        $e = FlattenException::create($e);

        return SymfonyResponse::create($html, $e->getStatusCode(), $e->getHeaders());
    }

Configuration

File pretty-errors.php, (*6)

$development = [

    \Peraleks\LaravelPrettyErrors\Notifiers\HtmlNotifier::class => [
        'enabled'       => true,   // [bool] switch error display as html
        'handleTrace'   => E_ALL,  // [int]  switch trace processing (bitwise mask)
        'simpleTrace'   => true,   // [bool] switch display arguments in trace
        'hideTrace'     => true,   // [bool] switch trace display on start
        'fontSize'      => 15,     // [int]  main font size in pixels (works as a scale)
        'stringLength'  => 80,     // [int]  line length in cells
        'tooltipLength' => 1000,   // [int]  line length in extended view
        'arrayLevel'    => 2,      // [int]  nesting level of arrays
    ],

    \Peraleks\LaravelPrettyErrors\Notifiers\BrowserConsoleNotifier::class => [
        'enabled'        => true,  // [bool]   switch error display in browser console
        'handleTrace'    => E_ALL, // [int]    switch trace processing (bitwise mask)
        'phpNativeTrace' => true,  // [bool]   switch PHP native trace display 
        'console'        => 'log', // [string] browser console section (error|warn|info|log|debug)
    ],
];



$production = [

    \Peraleks\LaravelPrettyErrors\Notifiers\ProductionNotifier::class => [
        'enabled' => true,         // [bool]   switch error page display in production
        'file404' => '',           // [string] fully qualified file name or blade-template name
        'file500' => '',           // [string] fully qualified file name or blade-template name

        /* For blade-template, write 'view.404' where '404' is the name for 404.blade.php .
         You can use native PHP template. To do this, enter the fully qualified file name.

         The file may not be a template, but must return or print a string.
         For example, a file can contain such a code:

         return "<h2>Page not found</h2>";

         or

         echo view('404')->render();
         */
    ],
];

License

The MIT License (MIT)., (*7)

The Versions

31/03 2017

dev-master

9999999-dev https://github.com/peraleks/laravel-pretty-errors

Error formatter for Laravel.

  Sources   Download

MIT

The Requires

 

laravel debug error handler error-handler peraleks pretty-errors

31/03 2017

v1.0.0

1.0.0.0 https://github.com/peraleks/laravel-pretty-errors

Error formatter for Laravel.

  Sources   Download

MIT

The Requires

 

laravel debug error handler error-handler peraleks pretty-errors