Download the PHP package visualweber/error-handler-custom without Composer
On this page you can find all versions of the php package visualweber/error-handler-custom. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download visualweber/error-handler-custom
More information about visualweber/error-handler-custom
Files in visualweber/error-handler-custom
Package error-handler-custom
Short Description A Error Handler for your ZF2 and ZF3 application to trap php errors & exceptions
License MIT
Homepage https://github.com/visualweber/ErrorHandlerCustom
Informations about the package error-handler-custom
ErrorHandlerCustom
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.
Features
- [x] Save to DB with Db Writer Adapter.
- [x] Log Exception (dispatch.error and render.error) and PHP Errors in all events process.
- [x] Support excludes PHP E_* Error (eg: exclude E_USER_DEPRECATED) in config settings.
- [x] Support excludes PHP Exception (eg: Exception class or classes that extends it) in config settings.
- [x] Handle only once log error for same error per configured time range.
- [x] Set default page (web access) or default message (console access) for error if configured 'display_errors' = 0.
- [x] Set default content when request is XMLHttpRequest via 'ajax' configuration.
- [x] Provide request information ( http method, raw data, query data, files data, and cookie data ).
- [x] Send Mail
- [x] many receivers to listed configured email
- [x] with include $_FILES into attachments on upload error.
Installation
1. Import the following SQL for Mysql
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
.
OR
If you use other RDBMS, you may configure your own
db
ordoctrine
config.
3. Require this module uses composer.
4. Copy config
a. For ZF2/ZF3 Mvc application, copy error-handler-custom.local.php.dist
config to your local's autoload and configure it
source | destination |
---|---|
vendor/visualweber/error-handler-custom/config/error-handler-custom.local.php.dist | config/autoload/error-handler-custom.local.php |
Or run copy command:
b. For ZF Expressive application, copy expressive-error-handler-custom.local.php.dist
config to your local's autoload and configure it
source | destination |
---|---|
vendor/visualweber/error-handler-custom/config/expressive-error-handler-custom.local.php.dist | config/autoload/expressive-error-handler-custom.local.php |
Or run copy command:
When done, you can modify logger service named ErrorHandlerCustomLogger
and error-handler-custom
config in your's local config:
5. Lastly, enable it
a. For ZF Mvc application
b. For ZF Expressive application
You need to use Zend\ServiceManager for service container and Zend\View for template engine.
For zend-expressive-skeleton ^1.0, It's should already just works!
For zend-expressive-skeleton ^2.0, you need to open config/pipeline.php
and add the ErrorHandlerCustom\Middleware\Expressive::class
middleware after default ErrorHandler::class
registration:
and also add error-preview
routes in config/routes.php
(optional) :
to enable error preview page. To disable error preview page, just remove it from routes.
Give it a try!
Web Access
URl | Preview For |
---|---|
http://yourzfapp/error-preview | Exception |
http://yourzfapp/error-preview/error | Error |
You will get the following page if display_errors config is 0:
For production env, you can disable error-preview sample page with set
['error-handler-custom']['enable-error-preview-page']
to false.
Console Access
If you use zend-mvc v3, you need to have
zendframework/zend-mvc-console
in your vendor, if you don't have, you can install it via command:
Command | Preview For |
---|---|
php public/index.php error-preview | Exception |
php public/index.php error-preview error | Error |
You will get the following page if display_errors config is 0:
For production env, you can disable error-preview sample page with set
['error-handler-custom']['enable-error-preview-page']
to false.For ZF Expressive, there is no default console implementation, so, if you want to apply it in your console in ZF Expressive, you may need to custom implementation error handler that utilize
ErrorHandlerCustom\Handler\Logging
service (see detailed usage atErrorHandlerCustom\Middleware\Expressive
class)
Contributing
Contributions are very welcome. Please read CONTRIBUTING.md
All versions of error-handler-custom with dependencies
seld/jsonlint Version ^1.5
zendframework/zend-console Version ^2.5
zendframework/zend-db Version ^2.5
zendframework/zend-log Version ^2.5
zendframework/zend-mail Version ^2.5
zendframework/zend-psr7bridge Version ^0.2.2|^1.0
zendframework/zend-servicemanager Version ^2.5|^3.0
zendframework/zend-text Version ^2.5