ehough / emailerrors-bundle
一个在应用程序中发生错误时发送电子邮件报告的Symfony2包。
此包的规范存储库似乎已消失,因此该包已被冻结。
v1.0.2
2013-11-13 22:31 UTC
Requires
- php: >=5.3.0
- symfony/framework-bundle: ~2.3
- symfony/swiftmailer-bundle: ~2.3
- twig/twig: ~1.0
Requires (Dev)
- mockery/mockery: dev-master@dev
- phpunit/phpunit: 3.7.*
- symfony/symfony: ~2.3
This package is not auto-updated.
Last update: 2019-02-27 11:11:53 UTC
README
此库不再维护。一个在应用程序中发生错误时发送电子邮件报告的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
以取消发送邮件。