PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Thomas Trautner   PHP Error Handler Class   test.php   Download  
File: test.php
Role: Example script
Content typex: text/plain
Description: testing
Class: PHP Error Handler Class
Output details when a PHP error occurs
Author: By
Last change:
Date: 2 days ago
Size: 1,931 bytes
 

Contents

Class file image Download
<?php
/* JUST TESTING */

include_once("errorhandler.class.php");

// ADDITIONAL OPTIONS
$php_errorhandler = new ErrorHandler(); // initialize
$php_errorhandler->performance(true); // show performance
$php_errorhandler->showSource(true); // show source code
$php_errorhandler->backtrace(true); // show backtrace
$php_errorhandler->showinfo(true); // show server information
$php_errorhandler->setDebug(false); // debug true = show global variables
$php_errorhandler->logfile('error.log'); // Enable file logging

/* EMAIL ALERTS
* $smtpConfig = [
* 'host' => 'smtp.yourdomain.com',
* 'port' => 587,
* 'encryption' => 'tls', // '', 'tls', 'ssl'
* 'username' => '[email protected]',
* 'password' => 'your-app-password',
* 'from' => '[email protected]',
* 'from_name' => 'Error System',
* 'timeout' => 30
* ];
* $php_errorhandler->mailto('[email protected]', 'en'); // Email alerts serverside
* $php_errorhandler->mailto('[email protected]', 'en',$smtpConfig); // Email alerts with SMTP
*/

// --- INCLUDE/REQUIRE FILES WITH SYNTAX CHECK
//$php_errorhandler->safeInclude('include_file.php'); // FORCES SYNTAX ERROR- COMMENT TO GET ERROR IN LINE 42
// $php_errorhandler->safeRequire('required_file.php'); // FORCES SYNTAX ERROR- COMMENT TO GET ERROR IN LINE 42

echo "Line 34: No errors here<br>";
echo
"Line 35: No errors here<br>";
echo
"Line 36: No errors here<br>";
echo
"Line 37: No errors here<br>";
echo
"Line 38: No errors here<br>";
echo
"Line 39: No errors here<br>";
echo
"Line 40: No errors here<br>";
echo
"Line 41: No errors here<br>";
error_in_line_42; // FORCES ERROR
echo "Line 43: No errors here<br>";
echo
"Line 44: No errors here<br>";
echo
"Line 45: No errors here<br>";
echo
"Line 46: No errors here<br>";
echo
"Line 47: No errors here<br>";
echo
"Line 48: No errors here<br>";