PHP code example of codeinc / error-renderer
1. Go to this page and download the library: Download codeinc/error-renderer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codeinc / error-renderer example snippets
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);