PHP code example of webiik / error

1. Go to this page and download the library: Download webiik/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/ */

    

webiik / error example snippets


$error = new \Webiik\Error\Error();

setSilent(bool $bool): void

$error->setSilent(true);

setSilentPageContent(string $string): void

$error->setSilentPageContent('<h1>Ups! Kitten lost!</h1>');

setSilentIgnoreErrors(array $arr): void

$error->setSilentIgnoreErrors([
    'E_NOTICE',
    'E_USER_NOTICE',
    'E_DEPRECATED',
    'E_USER_DEPRECATED',
]);

setErrLogDefLevel(string $level): void
 
$error->setErrLogDefLevel('error');

setErrLogLevel(array $assocArr): void

$error->setErrLogLevel([
    'Exception' => 'error',
    'E_ERROR' => 'error',
]);

setLogService(callable $function): void

$error->setLogService(function ($level, $message, $data) {
    // $level - PSR-3 log level
    // $message - Re-fromatted error message
    // $data - ['error type' => $errType, 'file' => $file, 'line' => $line, 'error message' => $message, 'trace' => $trace]
    // Your custom logger...
});