ehough/emailerrors-bundle

一个在应用程序中发生错误时发送电子邮件报告的Symfony2包。

此包的规范存储库似乎已消失,因此该包已被冻结。

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

此库不再维护。一个在应用程序中发生错误时发送电子邮件报告的Symfony2包。

####功能

  • 最小的性能影响
  • 轻松配置接收者和发送者地址
  • 仅在特定环境中启用(例如prod
  • 可以作用于
  • 异常
  • PHP错误(包括致命错误)
  • PHP警告
  • 可配置处理HTTP 404

####致谢

此作品主要基于Elao ErrorNotifierBundle,但增加了以下功能

  • 能够处理PHP致命错误
  • Swift库的懒加载初始化
  • 使用单元测试和功能测试开发

###要求

  • Symfony 2.3+
  • 必须注册并正确配置Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle在你的应用程序中。

###安装

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

然后,在app/AppKernel.php中注册此包。确保你的应用程序包括Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle包!

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

###配置

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

###事件

####ehough.bundle.emailErrors.preMail

在此包发送电子邮件之前立即调用。

  • 主题:一个关联数组,以下所示
    • exception => 正在被邮寄的\Symfony\Component\Debug\Exception\FlattenException实例。
    • request => 请求(\Symfony\Component\HttpFoundation\Request实例)
    • context => Twig上下文的关联数组。可能为空。
    • status_text => 由\Symfony\Component\HttpFoundation\Response::$statusTexts定义的HTTP状态文本。
  • 参数
    • shouldSend => 初始设置为true的布尔值。将其设置为false以取消发送邮件。