Download the PHP package rothkj1022/php-error-handler without Composer
On this page you can find all versions of the php package rothkj1022/php-error-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rothkj1022/php-error-handler
More information about rothkj1022/php-error-handler
Files in rothkj1022/php-error-handler
Package php-error-handler
Short Description PHP Error Handler can send you comprehensive error reports via email as well as output to the screen if you so choose.
License MIT
Informations about the package php-error-handler
php-error-handler
PHP Error Handler can send you comprehensive error reports via email as well as output to the screen if you so choose.
Features:
- Get notified via email of php errors occurring on your website
- Option to use mysqli or pdo database connection
- Send error reports via email, display to the screen, or both
- Can log all errors in a database, with customizable retention period
- Flood control makes sure you don't get blasted with multiple emails with the same error within a configurable time period
- Send to one or more email recipients, including cc and bcc options
- Only send reports for the error types you choose (errors, warnings, notices, deprecations)
Written by: Kevin Roth - https://kevinroth.com
License
Released under the MIT license - http://opensource.org/licenses/MIT
Requirements
- PHP >= 5.4
Optional
- MySQL or other PDO compatible database for logging & flood control features
Installation
Run the following command in your command line shell in your php project
Done.
You may also edit composer.json manually then perform :
Getting started
Example usage with composer
Example usage without composer
Example with email and database configuration
After including the class file via autoload.php or directly, instantiate the object with a json array like this:
Configuration options
General
displayErrors
Display error details to screen (not recommended for production)
emailErrors
Email error reports to configured recipient(s)
logErrors
Log errors to configured database
cacheFolder
Folder for caching lookups, such as ip addresses
purgeLogInterval
If configured, purges logs in database older than the given interval.
Use mysql date_add interval syntax or set to false
floodInterval
If database is configured, does not send repeat errors via email within set interval
Use mysql date_add interval syntax or set to false
database
Json array of database configuration options
MySQL Example:
PDO (with mysql) Example:
driver
Driver to be used for the database connection
dsn
DSN connection string for PDO connections
hostname
Host name of the database server
username
Database user name
password
Database password
database
Database name
port
Database port
charset
Database character set
table
Database table name for logging error reports
recipients
Array of to, cc, or bcc types
to, cc, & bcc
Array of contacts (name, address)
address
Email address of the contact
name
Name of the contact
from
address
Email address of the contact
name
Name of the contact
replyTo
address
Email address of the contact
name
Name of the contact
subject
PHPMailer
Json array of email configuration options. See PHPMailer documentation for detailed default options.
CharSet
isSMTP
Host
Port
SMTPDebug
Get debug info for SMTP sending. See SMTP Debugging for more info.
See also PHPMailer SMTPDebug property documentation
SMTPAutoTLS
Whether to enable TLS encryption automatically if a server supports it, even if `SMTPSecure` is not set to 'tls'.
See also PHPMailer SMTPAutoTLS property documentation
SMTPAuth
Enable SMTP authorization
Username
SMTP account username / email address
Password
SMTP Password
SMTPSecure
Type of encryption used for SMTP sending
SMTPOptions
See PHPMailer SMTPOptions property documentation
Example
errorTypes
Array of PHP error types that you want to be handled
warningTypes
Array of PHP warning types that you want to be handled
noticeTypes
Array of PHP warning types that you want to be handled
handleErrors
Whether or not to process errors
handleWarnings
Whether or not to process warnings
handleNotices
Whether or not to process notices
ipinfoToken
Your API token for ipinfo.io if you have one
Public methods
Plugin method | Description |
---|---|
mysqlError($errorMsg, $sql, $errfile = null, $errline = 0, $die = false) | Send a MySQL-specific error report, including the query. $errorMsg = the error message to send, usually $mysqli->error. $sql = the query. $errfile = the file in which the error occurred, called by using __FILE__. $errline = the line of the file on which the error occurred, called by using __LINE__. $die = whether or not to stop processing the script after sending the error. See example below. |
sendError($errorMsg, $msgDetails = '', $errfile = null, $errline = 0, $die = false) | Send a custom error report. $errorMsg = the error message to send. $msgDetails = further details regarding your custom error. $errfile = the file in which the error occurred, called by using __FILE__. $errline = the line of the file on which the error occurred, called by using __LINE__. $die = whether or not to stop processing the script after sending the error. See example below. |
mysqlError Example:
sendError Example:
Changelog
Version 2.0.7
- Added config var for ipinfo.io API token
- Fixed flood control
Version 2.0.6
- Updated ip address lookups to fetch with Guzzle for better reliability.
- Added cacheFolder option for caching remote lookups
Version 2.0.5
- Added config var for allowing change of PHPMailer SMTPAutoTLS setting
Version 2.0.4
- Added config vars for allowing change of reply-to address
Version 2.0.3
- Added config vars to disable processing errors, warnings, and notices
Version 2.0.1 & 2.0.2
- Fixes for composer integration
Version 2.0.0
- Code overhaul with composer integration
- Added changelog, readme documentation
- Enhancement: added PDO database option
All versions of php-error-handler with dependencies
phpmailer/phpmailer Version ^6.5.0
guzzlehttp/guzzle Version ^6.3
rothkj1022/php-cache-class Version ^2.1.2
symfony/var-dumper Version ^4.2