Download the PHP package classmarkets/raven-bundle without Composer
On this page you can find all versions of the php package classmarkets/raven-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download classmarkets/raven-bundle
More information about classmarkets/raven-bundle
Files in classmarkets/raven-bundle
Package raven-bundle
Short Description Display sentry event ids on error pages
License MIT
Informations about the package raven-bundle
raven-bundle
Are you using sentry for exception monitoring in Symfony 2? Good! Now let's show meaningful error pages to your users.
Sentry generates ids for each event it receives. This bundle adds a Twig function that let's you access those event ids in error page templates:
You can also lookup event ids wherever the DIC is available like this:
Installation
The usual. Install it with composer require classmarkets/raven-bundle ~1.0.0
and
add it to the kernel:
Configuration
Quickstart
Assuming you are using Monolog's raven handler already, and have not changed
the twig.exception_listener
service, you already have something like this:
Turn it into this:
If you already have monolog.raven.client_id
configured, omit the extra
service definition.
The important thing is that monolog.raven.client_id
equals
cm_raven.client_id
.
If you are not using monolog, find the id for the service that provides the
Raven_Client
instance, and set cm_raven.client_id
to that id.
How it works
There are two parts to this bundle. Remembering event ids and making them available to error pages.
The first part is easy. All we have to do is decorate a Raven_Client
service
with an event id recorder.
The second part is tricky because the original exception doesn't make it into
the template engine. Instead, it gets converted into a FlattenException
.
This FlattenException is unknown to our event recorder (because it only saw
the original exception).
The FlattenException gets created by some protected method in the
twig.exception_listener
service. To solve our problem, we replace that
service to associate the FlattenException with the same event id as the
original exception.
If your application already has a custom twig.exception_listener
service,
disable our implementation and call
@cm_raven.sentry_event_recorder::addExceptionAlias($originalException, $flattenException)
yourself (see
ExceptionListener.php).
To disable the exception listener configure
All versions of raven-bundle with dependencies
symfony/framework-bundle Version ~3.0|~4.0
symfony/twig-bundle Version ~3.0|~4.0
raven/raven Version ~0.11