ehough/emailerrors-bundle

A Symfony2 bundle that sends out an email report when an error occurs in your app.

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.2 2013-11-13 22:31 UTC

This package is not auto-updated.

Last update: 2019-02-27 11:11:53 UTC


README

Build Status Project Status: Unsupported - The project has reached a stable, usable state but the author(s) have ceased all work on it. A new maintainer may be desired. Latest Stable Version License

This library is no longer maintained. A Symfony2 bundle that sends out an email report when an error occurs in your app.

####Features

  • Minimal performance footprint
  • Easily configure the recipient and sender addresses
  • Enable only in certain environments (e.g. prod)
  • Can act on
  • Exceptions
  • PHP errors (including fatal)
  • PHP warnings
  • Configurable handling of HTTP 404s

####Credits

This work is largely based on the Elao ErrorNotifierBundle, but with the following additional features:

  • Able to handle PHP fatal errors
  • Lazy initialization of Swift library
  • Developed with unit and functional tests

###Requirements

  • Symfony 2.3+
  • The Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle must be registered and configured properly in your app.

###Installation Add to your composer.json

"require" : {
   "ehough/emailerrors-bundle" : "dev-master"
}

Then register the bundle in app/AppKernel.php. It's essential that your app includes the Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle bundle!

public function registerBundles()
{
    return array(
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        // ...
        new Ehough\Bundle\EmailErrorsBundle\EhoughEmailErrorsBundle()
    );
}

###Configuration In your app's config.yml (or config_prod.yml)

ehough_email_errors:
  to: admin@yoursite.com              # recipient address. required
  from: noreply@yoursite.com          # sender address. required
active_environments: [ 'prod', 'dev' ]  # an array of environments in which to run. default ['prod']
handle:
  warnings: true                      # handle PHP warnings? default true
  exceptions: true                    # handle exceptions? default true
  http_404: true                      # handle HTTP 404s? default false
  errors: true                        # handle PHP errors? default true

###Events This bundles utilizes Symfony's event dispatcher to allow additional customization. These events are described below.

####ehough.bundle.emailErrors.preMail

Invoked immediately before this bundle sends out an email.

  • Subject: An associative array with the following:
    • exception => The \Symfony\Component\Debug\Exception\FlattenException instance that is being mailed.
    • request => The request (instance of \Symfony\Component\HttpFoundation\Request)
    • context => An associative array of the Twig context. May be empty.
    • status_text => The HTTP status text as defined by \Symfony\Component\HttpFoundation\Response::$statusTexts
  • Arguments
    • shouldSend => Boolean initially set to true. Set to false to cancel sending of the mail.