25th / zf2-exception-mailer-module
Zend Framework 2 Module that provides a Simple Exception Mailer functionality
Installs: 2 732
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 9
Forks: 3
Open Issues: 0
Requires
- php: >=5.3
- zendframework/zend-mvc: 2.*
- zendframework/zend-servicemanager: 2.*
This package is not auto-updated.
Last update: 2024-11-22 09:57:33 UTC
README
A simple ZF2 Module for sending Mails if Exceptions happen on production systems. In it's simplest configuration it just sends the stack trace of the Exception. But you can also render views and send html mails instead.
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
php composer.phar require 25th/zf2-exception-mailer-module
# (When asked for a version, type `0.*`)
Then add ExceptionMailer
to your config/application.config.php
.
Installation without composer is not officially supported and requires you to manually install all dependencies
that are listed in composer.json
Configuration
To configure the Mailer use your application config:
<?php return array( // Exception Stuff 'exception_mailer' => array( // Mail 'send' => true, 'sender' => 'your-sender-address@mail.com', 'recipients' => array( 'your-recipient-address@mail.com', ), 'subject' => 'My Exception Mailer', 'exceptionInSubject' => false // HTML Templates 'useTemplate' => false, 'template' => 'error/index' ), );
Ignore Exceptions
It's also possible to ignore certain Exceptions. Just let them implement the IgnoreExceptionInterface and they will be ignored.
HTML Emails
For HTML Emails set useTemplate to true and use the template parameter for your template configuration.
If you want to use a different template f.e. "error/mail" you also have to define it in the view_manager => template_map array with the correct position to it
<?php return array( ... 'view_manager' => array( 'template_map' => array( ... 'error/mail' => __DIR__ . '/../view/error/mail.phtml', // Exception_Mailer ... ), ), ... );