1. Go to this page and download the library: Download letsface/php-error-handler 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/ */
letsface / php-error-handler example snippets
$handler = new \Letsface\ExceptionHandler();
$handler->listen('123', function() {
return 'foo';
});
try {
throw new \MyException('', '123');
}
catch(\Exception $e) {
// will echo "foo";
echo $handler->handle($e);
}
$handler = new \Letsface\ExceptionHandler();
$handler->throws('123', new \AnotherException('My new message', 'NEWCODE'));
try {
throw new \MyException('', '123');
}
catch(\Exception $e) {
// will throw "\AnotherException";
$handler->handle($e);
}
$handler = new \Letsface\ExceptionHandler();
$handler->rethrow('123');
try {
throw new \MyException('', '123');
}
catch(\Exception $e) {
// will throw $e;
$handler->handle($e);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.