rickselby/laravel-exception-html

Generate HTML output for an exception

0.4.0 2024-03-15 07:22 UTC

This package is auto-updated.

Last update: 2024-04-15 07:34:03 UTC


README

Software License Packagist Version

When Symfony updated to version 5, they changed their exception handling, and this removed a very neat way of generating HTML for an exception to populate an email:

$handler = new ExceptionHandler(true);
$html = $handler->getHtml($this->exception);

This is a copy of the Symfony 4 code to allow the above snippet to work again.

Additional HTML

You may pass some additional HTML heading tags to display in the main title block. This can be any additional information useful to your exception (e.g. request URL, logged in user...)

<h3 class="exception-message">{$this->request->method()} {$this->request->fullUrl()}</h3>
$handler = new ExceptionHandler(true);
$html = $handler->getHtml($this->exception, $extraHeadings);