PHPackages                             visualweber/error-handler-custom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. visualweber/error-handler-custom

ActiveLibrary[Database &amp; ORM](/categories/database)

visualweber/error-handler-custom
================================

A Error Handler for your ZF2 and ZF3 application to trap php errors &amp; exceptions

1.0(8y ago)0129MITPHPPHP ^5.6|^7.0

Since Apr 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/visualweber/error-handler-custom)[ Packagist](https://packagist.org/packages/visualweber/error-handler-custom)[ Docs](https://github.com/visualweber/ErrorHandlerCustom)[ RSS](/packages/visualweber-error-handler-custom/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (15)Versions (3)Used By (0)

ErrorHandlerCustom
==================

[](#errorhandlercustom)

Introduction
------------

[](#introduction)

ErrorHandlerCustom is a module for Error Logging (DB and Mail) your ZF2, ZF3 Mvc Application, and ZF Expressive for Exceptions in 'dispatch.error' or 'render.error' or during request and response, and [PHP E\_\* Error](http://www.php.net/manual/en/errorfunc.constants.php).

Features
--------

[](#features)

- Save to DB with Db Writer Adapter.
- Log Exception (dispatch.error and render.error) and PHP Errors in all events process.
- Support excludes [PHP E\_\* Error](http://www.php.net/manual/en/errorfunc.constants.php) (eg: exclude E\_USER\_DEPRECATED) in config settings.
- Support excludes [PHP Exception](http://php.net/manual/en/spl.exceptions.php) (eg: Exception class or classes that extends it) in config settings.
- Handle only once log error for same error per configured time range.
- Set default page (web access) or default message (console access) for error if configured 'display\_errors' = 0.
- Set default content when request is XMLHttpRequest via 'ajax' configuration.
- Provide request information ( http method, raw data, query data, files data, and cookie data ).
- Send Mail
    - many receivers to listed configured email
    - with include $\_FILES into attachments on upload error.

Installation
------------

[](#installation)

**1. Import the following SQL for Mysql**

```
DROP TABLE IF EXISTS `log`;

CREATE TABLE `log` (
  `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` int(11) NOT NULL,
  `event` text NOT NULL,
  `url` varchar(2000) NOT NULL,
  `file` varchar(2000) NOT NULL,
  `line` int(11) NOT NULL,
  `error_type` varchar(255) NOT NULL,
  `trace` text NULL,
  `request_data` text NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
```

> If you use other RDBMS, you may follow the `log` table structure above.

**2. Setup your Zend\\Db\\Adapter\\Adapter service or your Doctrine\\ORM\\EntityManager service config**

You can use 'db' (with *Zend\\Db*) config or 'doctrine' (with *DoctrineORMModule*) config that will be converted to be usable with `Zend\Log\Writer\Db`.

```
