1. Go to this page and download the library: Download dmitry-suffi/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/ */
dmitry-suffi / error-handler example snippets
$handler = new \suffi\ErrorHandler\ErrorHandler();
set_error_handler([$handler, 'errorHandler']);
set_exception_handler([$handler, 'exceptionHandler']);
//Page with an error message
protected function htmlError(string $errstr)
{
return $errstr;
}
//Report an error for ajax-request
protected function jsonError(string $errstr)
{
return json_encode(['error' => $errstr]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.