PHPackages                             oneup/contao-sentry-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. oneup/contao-sentry-bundle

ActiveContao-bundle[Logging &amp; Monitoring](/categories/logging)

oneup/contao-sentry-bundle
==========================

This bundle provides an easy integration of sentry.io for Contao 4.4.x and newer.

4.2.1(3mo ago)1116.3k↓16.7%6MITPHPPHP ^8.1

Since Aug 27Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/1up-lab/contao-sentry-bundle)[ Packagist](https://packagist.org/packages/oneup/contao-sentry-bundle)[ Docs](https://github.com/1up-lab/contao-sentry-bundle)[ RSS](/packages/oneup-contao-sentry-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (22)Versions (14)Used By (0)

Contao Sentry Bundle
====================

[](#contao-sentry-bundle)

This Contao bundle provides an easy integration of [sentry.io](https://sentry.io/) for Contao 4.13 and 5.x.

[![Author](https://camo.githubusercontent.com/a1ca831710cc70c5c356e8dbc27e1212ed4d41a3ad0c6d9f7afbb02d78250cf4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40317570676d62682d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/1upgmbh)[![Software License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/8d2de5eec39325181835369407f54944ba545ab1320a940dae4846a06f0dce59/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e6575702f636f6e74616f2d73656e7472792d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oneup/contao-sentry-bundle)

\--

This is a "wrapper extension" for the [`sentry/sentry-symfony` bundle](https://github.com/getsentry/sentry-symfony/).

### Setup in the Contao Managed Edition

[](#setup-in-the-contao-managed-edition)

The basic integration is automatically configured to some sane defaults. To enable the integration, configure the `SENTRY_DSN` variable in your `.env.local` file.

Additionally, you can name the `SENTRY_ENV` in your `.env.local` file, which can be useful if you e.g. have a `test` and `prod` installation.

If you need to change any of the defaults, simply configure the `sentry/sentry-symfony` bundle according to the [Documentation](https://docs.sentry.io/platforms/php/guides/symfony/#install).

### Manual configuration

[](#manual-configuration)

If you do not use the Contao Managed Edition, you need to configure this bundle as you would configure the `sentry/sentry-symfony` bundle: [Documentation](https://docs.sentry.io/platforms/php/guides/symfony/#install)

### Special case `before_send` callback

[](#special-case-before_send-callback)

In the `sentry/sentry-symfony` bundle, there can only be one service responsible for filtering events before sending them to sentry. You'd configure it like so:

```
sentry:
    options:
        before_send: 'my_service_id'
```

However, this conflicts with the idea of this bundle to be extensible. Hence, this bundle ships with a default callback that dispatches the `BeforeSendEvent`. Thus giving other extensions (or your app), the option to filter the events before sending, without replacing each other.

Usage:

```
use Oneup\ContaoSentryBundle\Event\BeforeSendEvent;
use Sentry\Event;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
class SentryBeforeSendListener
{
    public function __invoke(BeforeSendEvent $beforeSendEvent): void
    {
        // Might have been unset already by a different listener
        $event = $beforeSendEvent->getEvent();
        if (null === $event) {
            return;
        }

        // Your custom logic
        if ($this->shouldEventBeIgnored($event)) {
            $beforeSendEvent->setEvent(null);
        }
    }
}
```

### User feedback

[](#user-feedback)

On the other hand you might want to implement the [User feedback](https://docs.sentry.io/platforms/javascript/user-feedback/) feature of sentry. The user feedback is primarily useful to let the users know that you've gotten notified about the issue and to let users give the opportunity to add some comments.

In order to integrate this feature, you have to alter the error page template. Place a copy of `vendor/contao/core-bundle/src/Resources/views/Error/layout.html.twig` in the directory `templates/ContaoCoreBundle/views/Error/`.

Modify the copied template and place the following snippet just before the closing `` tag:

```
{% set sentry_id = ''|sentry_last_event_id %}
{% if sentry_id %}

        Sentry.init({dsn: '{{ ''|sentry_dsn }}'});
        Sentry.showReportDialog({eventId: '{{ sentry_id }}'})

        // You can also bind the "show" method to an event, e.g. to open the modal on button click
        {#document.querySelector('.btn-report').addEventListener('click', function (e) {#}
        {#    e.preventDefault();#}
        {#    Sentry.showReportDialog({eventId: '{{ sentry_id }}'})#}
        {#});#}

{% endif %}
```

[![User Feedback in action](https://user-images.githubusercontent.com/1284725/41782120-a06637f0-7639-11e8-96d7-a053e7ddd232.png)](https://user-images.githubusercontent.com/1284725/41782120-a06637f0-7639-11e8-96d7-a053e7ddd232.png)

Error tracking helper
---------------------

[](#error-tracking-helper)

The `Oneup\ContaoSentryBundle\ErrorHandlingTrait` adds useful Sentry helpers.

- `ErrorHandlingTrait::sentryOrThrow` will either log an error/exception to sentry, or it will throw an exception if Sentry integration is not available (e.g. on localhost or in `dev` environment). It is mostly useful when running looping cronjobs, like synchronizing Contao with a remote system, so an error on syncing a record will not prevent the sync loop from finishing other records.
- `ErrorHandlingTraig::sentryCheckIn` has been added for the new [Sentry Cron job monitoring](https://docs.sentry.io/product/crons/). Call `sentryCheckIn()` without argument to start a check in, and subsequently with a boolean `true` or `false` after the job has successfully run or failed.

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance78

Regular maintenance activity

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~229 days

Recently: every ~164 days

Total

13

Last Release

116d ago

Major Versions

1.0.1 → 2.0.02019-11-23

2.0.1 → 3.0.02021-05-07

3.2.0 → 4.0.02024-05-23

PHP version history (3 changes)1.0.0PHP &gt;=7.1

3.1.0PHP ^7.1 || ^8.0

4.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/87bf1d07a851471e5d0ba2052e6a7a78d6313378214087a2919ff9979656ad0b?d=identicon)[bytehead](/maintainers/bytehead)

---

Top Contributors

[![bytehead](https://avatars.githubusercontent.com/u/754921?v=4)](https://github.com/bytehead "bytehead (10 commits)")[![aschempp](https://avatars.githubusercontent.com/u/1073273?v=4)](https://github.com/aschempp "aschempp (4 commits)")[![richardhj](https://avatars.githubusercontent.com/u/1284725?v=4)](https://github.com/richardhj "richardhj (3 commits)")[![f-schnabel](https://avatars.githubusercontent.com/u/29004905?v=4)](https://github.com/f-schnabel "f-schnabel (2 commits)")[![qzminski](https://avatars.githubusercontent.com/u/193483?v=4)](https://github.com/qzminski "qzminski (1 commits)")[![fritzmg](https://avatars.githubusercontent.com/u/4970961?v=4)](https://github.com/fritzmg "fritzmg (1 commits)")[![Toflar](https://avatars.githubusercontent.com/u/481937?v=4)](https://github.com/Toflar "Toflar (1 commits)")

---

Tags

errortrackingsentrycontaoraven

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/oneup-contao-sentry-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/oneup-contao-sentry-bundle/health.svg)](https://phpackages.com/packages/oneup-contao-sentry-bundle)
```

###  Alternatives

[contao-community-alliance/dc-general

Universal data container for Contao

1680.8k92](/packages/contao-community-alliance-dc-general)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M420](/packages/drupal-core-recommended)[shopware/storefront

Storefront for Shopware

684.6M236](/packages/shopware-storefront)[terminal42/notification_center

Notification Center extension for Contao Open Source CMS

80413.7k101](/packages/terminal42-notification-center)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
