codeinc / error-renderer
Code Inc.'s error display library
Installs: 273
Dependents: 12
Suggesters: 2
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/codeinc/error-renderer
Requires
- php: >=7.1
- kevinlebrun/colors.php: ^1
- matthiasmullie/minify: ^1.3
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2020-02-04 16:10:30 UTC
README
The PHP 7 library provides to classes dedicated to render exceptions and errors (everything which implements Throwable
).
Usage
<?php use CodeInc\ErrorRenderer\HtmlErrorRenderer; use CodeInc\ErrorRenderer\ConsoleErrorRenderer; // Creating a fake exception $fakeException = new \Exception("A last exception", 1010, new \Exception("A child exception", 0, new \Exception("A source exception"))); // Rendering for a web browser echo new HtmlErrorRenderer($fakeException); // Rendering for CLI echo new ConsoleErrorRenderer($fakeException); // Rendering using option (all option enabled) echo new ConsoleErrorRenderer($fakeException, ConsoleErrorRenderer::OPT_ALL); // Rendering with all options but no colors echo new ConsoleErrorRenderer($fakeException, ConsoleErrorRenderer::OPT_ALL ^ ConsoleErrorRenderer::OPT_COLORS);
Installation
This library is available through Packagist and can be installed using Composer:
composer require codeinc/error-renderer
License
The library is published under the MIT license (see LICENSE
file).