1. Go to this page and download the library: Download webservco/error 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/ */
webservco / error example snippets
interface ErrorHandlerInterface
{
public function handle(
// The first parameter, errno, will be passed the level of the error raised, as an integer.
int $errno,
// The second parameter, errstr, will be passed the error message, as a string.
string $errstr,
// If the callback accepts a third parameter, errfile,
// it will be passed the filename that the error was raised in, as a string.
string $errfile,
// If the callback accepts a fourth parameter, errline,
// it will be passed the line number where the error was raised, as an integer.
int $errline,
// $errcontext removed in PHP 8
): bool;
}
interface ErrorHandlingServiceFactoryInterface
{
public function createErrorHandlingService(): ErrorHandlingServiceInterface;
}
interface ErrorHandlingServiceInterface
{
public function handlePreExecutionErrors(): bool;
public function initialize(): bool;
public function restore(): bool;
}
// Create service.
$errorHandlingServiceFactory = new DefaultErrorHandlingServiceFactory();
$errorHandlingService = $errorHandlingServiceFactory->createErrorHandlingService();
// In application bootstrap:
$errorHandlingService->initialize();
$errorHandlingService->handlePreExecutionErrors();
// Application run.
// In application shutdown:
$errorHandlingService->restore();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.