PHP code example of kiss-php / errors
1. Go to this page and download the library: Download kiss-php/errors 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/ */
kiss-php / errors example snippets
Kiss\Errors\ALL;
ALL::callback(function (string $type, $error, $message, $file, $line, $level) {
echo '[' . $type . '] ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\WARNING;
WARNING::callback(function ($error, $message, $file, $line, $level) {
echo 'Warning: ' . $message . ' in ' . $file . ':' . $line;
});
fopen('missing-file.txt', 'r');
Kiss\Errors\NOTICE;
NOTICE::callback(function ($error, $message, $file, $line, $level) {
echo 'Notice: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\ERROR;
ERROR::callback(function ($error, $message, $file, $line, $level) {
echo 'Error: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\DEPRECATED;
DEPRECATED::callback(function ($error, $message, $file, $line, $level) {
echo 'Deprecated: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\STRICT;
STRICT::callback(function ($error, $message, $file, $line, $level) {
echo 'Strict: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\RECOVERABLE;
RECOVERABLE::callback(function ($error, $message, $file, $line, $level) {
echo 'Recoverable error: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\PARSE_ERROR;
PARSE_ERROR::callback(function ($error, $message, $file, $line, $level) {
echo 'Parse error: ' . $message . ' in ' . $file . ':' . $line;
});
Kiss\Errors\EXCEPTION;
EXCEPTION::callback(function ($error, $message, $file, $line, $level) {
echo 'Exception: ' . $message . ' in ' . $file . ':' . $line;
});
$result = 24 / 0;
bash
composer