PHP code example of rothkj1022 / php-error-handler

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

    

rothkj1022 / php-error-handler example snippets



use rothkj1022\PHPErrorHandler;

$errorHandler = new PHPErrorHandler\PHPErrorHandler();


use rothkj1022\PHPErrorHandler;

$errorHandler = new PHPErrorHandler\PHPErrorHandler();

$errorHandler = new PHPErrorHandler\PHPErrorHandler([
	'displayErrors' => false,
	'emailErrors' => true,
	'logErrors' => true, //ching lookups, such as ip addresses.  Must end with slash.
	'floodControl' => '15 MINUTE', //use mysql date_add interval syntax or set to false
	'database' => [
		/*'driver' => 'mysql', //pdo or mysql
		'hostname' => DB_HOSTNAME,
		'username' => DB_USERNAME,
		'password' => DB_PASSWORD,
		'database' => DB_DATABASE,
		'port' => DB_PORT,
		'charset' => DB_CHARSET,*/
		'driver' => 'pdo', //pdo or mysql
		'dsn' => 'mysql:host='.DB_HOSTNAME.';dbname='.DB_DATABASE.';port='.DB_PORT.';charset=UTF8',
		'username' => DB_USERNAME,
		'password' => DB_PASSWORD
	],
	'email' => [
		'recipients' => [
			'to' => [
				[
					'address' => '[email protected]',
					'name' => 'Test Guy'
				]
		],
		'from' => [
			'address' => '[email protected]',
			'name' => 'No Reply'
		]
	]
]);

"    "rothkj1022/php-error-handler": "^2.0.0"
}

[
	'driver' => 'pdo',
	'dsn' => 'mysql:host=localhost;dbname= mydatabase;port=3306;charset=UTF8',
	'username' => 'mysqluser',
	'password' => 'mysqlpass'
]

default: 'PHP Error Report from ' . $_SERVER['SERVER_NAME']
options: string

default: [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR]
options: array

default: [E_WARNING, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_RECOVERABLE_ERROR]
options: array

default: [E_NOTICE, E_USER_NOTICE, E_DEPRECATED, E_USER_DEPRECATED]
options: array