Download the PHP package kowada-gmbh/error-reporting-bundle without Composer
On this page you can find all versions of the php package kowada-gmbh/error-reporting-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kowada-gmbh/error-reporting-bundle
More information about kowada-gmbh/error-reporting-bundle
Files in kowada-gmbh/error-reporting-bundle
Package error-reporting-bundle
Short Description Shared Symfony bundle that automatically e-mails logged errors to a configurable address.
License proprietary
Informations about the package error-reporting-bundle
Kowada Error Reporting Bundle
Shared Symfony bundle that automatically e-mails logged errors to a configurable address.
The bundle is maintained here as a versioned Composer dependency and pulled into individual Symfony projects via composer update kowada-gmbh/error-reporting-bundle.
Installation
The package is public on Packagist (the source itself stays proprietary, only the distribution is public) and can be required as a regular dependency:
Features
All classes under Kowada\ErrorReportingBundle\ are automatically registered as services via autowiring/autoconfiguration (see config/services.yaml).
Errors that get logged (except HTTP client errors, i.e. any 4xx status) are automatically e-mailed to a configurable address.
Message\ErrorMessageover the Messenger bus.MessageHandler\ErrorMessageHandler: sends the e-mail, including the stack trace as an attachment, via@KowadaErrorReporting/emails/error.{html,txt}.twig(needssymfony/twig-bundleactive - without it,TemplatedEmailsilently sends with an empty body instead of failing loudly). The subject names the exception, e.g.ERROR my-app(prod): RuntimeException: Boom, and the body lists the log message and the exception (class, message, file and line) under separate headings.
If sending the e-mail itself fails (misconfiguration, mailer outage, unreachable Messenger transport), ErrorHandler catches that instead of letting the exception propagate: the original error is therefore never hidden (it still reaches the other Monolog handlers as usual, e.g. the log file), and the reporting failure is additionally recorded via PHP's error_log(). If an asynchronous Messenger worker ultimately fails to deliver an ErrorMessage (after exhausting retries), this is detected instead of dispatching another ErrorMessage about it — preventing a loop of error reports about failed error reports. Detection relies on the message class Messenger adds to its log context, so it also covers failures before the handler runs, like a mailer that can't be created from an invalid MAILER_DSN.
Configuration in the consuming project:
-
Bundle configuration in
config/packages/kowada_error_reporting.yaml:If
receiverorsender_addressis missing, the handler throws anUnrecoverableMessageHandlingExceptionon every error. This does not abort the request/command —ErrorHandlercatches it (see above) and writes a notice viaerror_log()instead. Needless to say, you can also use environment variables for configuration instead of baking the values into the app. -
Register the handler in
config/packages/monolog.yaml— recommended in front of Monolog's owndeduplicationhandler, so a recurring error (a cron loop, a broken high-traffic page) doesn't trigger a new e-mail on every single occurrence:kowada_error_mail_dedupis the handler actually active in the stack; MonologBundle recognizeskowada_error_mailas referenced by it and does not additionally register it on its own — so nothing needs to be configured twice here.time(in seconds) sets how long an identical error (same level + same message text) is suppressed after the first delivery; the first occurrence of an error is never delayed by this. If plain registration without deduplication is enough, thekowada_error_mailblock alone suffices. -
Recommended: route
ErrorMessageto an asynchronous Messenger transport so sending the e-mail doesn't block the request:Without routing, the e-mail is sent synchronously within the current request.
- A working
symfony/mailertransport (MAILER_DSN) is assumed.
Development
All versions of error-reporting-bundle with dependencies
monolog/monolog Version ^3.0
symfony/config Version ^7.4 || ^8.0
symfony/dependency-injection Version ^7.4 || ^8.0
symfony/http-kernel Version ^7.4 || ^8.0
symfony/mailer Version ^7.4 || ^8.0
symfony/messenger Version ^7.4 || ^8.0
symfony/monolog-bundle Version ^4.0
symfony/twig-bundle Version ^7.4 || ^8.0
symfony/yaml Version ^7.4 || ^8.0