PHPackages                             dbannik/sentry-symfony - 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. dbannik/sentry-symfony

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

dbannik/sentry-symfony
======================

Symfony integration for Sentry (http://getsentry.com)

5.2.0(1y ago)03MITPHP ^7.2||^8.0

Since Apr 29Pushed 11mo agoCompare

[ Source](https://github.com/dbannik/sentry-symfony)[ Packagist](https://packagist.org/packages/dbannik/sentry-symfony)[ Docs](http://getsentry.com)[ RSS](/packages/dbannik-sentry-symfony/feed)WikiDiscussions 4.x Synced 1mo ago

READMEChangelogDependencies (34)Versions (101)Used By (0)

 [ ![Sentry](https://camo.githubusercontent.com/63d7d9ecd366a58bdf965da3824d392a4ef345b8097753faa12ae07738ac8431/68747470733a2f2f73656e7472792d6272616e642e73746f726167652e676f6f676c65617069732e636f6d2f73656e7472792d776f72646d61726b2d6461726b2d3238307838342e706e67) ](https://sentry.io/?utm_source=github&utm_medium=logo)

*Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us [**Check out our open positions**](https://sentry.io/careers/)*

Official Sentry SDK for Symfony
===============================

[](#official-sentry-sdk-for-symfony)

[![Stable release](https://camo.githubusercontent.com/2446775afa4bdfeaff651e2a22cb53ee3f284431849624a221e0c44bd0584db4/68747470733a2f2f706f7365722e707567782e6f72672f73656e7472792f73656e7472792d73796d666f6e792f76657273696f6e2e737667)](https://packagist.org/packages/sentry/sentry-symfony)[![License](https://camo.githubusercontent.com/121cce4d92f02c2308a2235560430bcd1b7ca8ada388d8bcba2e8b3f7f28f171/68747470733a2f2f706f7365722e707567782e6f72672f73656e7472792f73656e7472792d73796d666f6e792f6c6963656e7365)](https://packagist.org/packages/sentry/sentry-symfony)[![Total Downloads](https://camo.githubusercontent.com/0108c6e4ee93232a04e9afa75e3096f9cfde877deb05934e6582e0f49efb5434/68747470733a2f2f706f7365722e707567782e6f72672f73656e7472792f73656e7472792d73796d666f6e792f646f776e6c6f616473)](https://packagist.org/packages/sentry/sentry-symfony)[![Monthly Downloads](https://camo.githubusercontent.com/ecbd35a279c4dc786eca05a90dbc4a0dbd11e28da2df371130fec8f68b56e8b7/68747470733a2f2f706f7365722e707567782e6f72672f73656e7472792f73656e7472792d73796d666f6e792f642f6d6f6e74686c79)](https://packagist.org/packages/sentry/sentry-symfony)

[![CI](https://github.com/getsentry/sentry-symfony/workflows/CI/badge.svg)](https://github.com/getsentry/sentry-symfony/workflows/CI/badge.svg) [![Coverage Status](https://camo.githubusercontent.com/f038b4981ceacb69b63c37b5285888bd1bd679719cd658c3712be10bdcd758bf/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f67657473656e7472792f73656e7472792d73796d666f6e792f6d61737465723f6c6f676f3d636f6465636f76)](https://codecov.io/gh/getsentry/sentry-symfony/branch/master)[![Discord](https://camo.githubusercontent.com/2da2973533965a9404e5ef0683e6cd8192988281f5860256076294e906b9c40c/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f363231373738383331363032323231303634)](https://discord.gg/cWnMQeA)

This is the official Symfony SDK for [Sentry](https://getsentry.com/).

Getting Started
---------------

[](#getting-started)

Using this `sentry-symfony` SDK provides you with the following benefits:

- Quickly integrate and configure Sentry for your Symfony app
- Out of the box, each event will contain the following data by default
    - The currently authenticated user
    - The Symfony environment

### Install

[](#install)

To install the SDK you will need to be using Composer in your project. To install it please see the [docs](https://getcomposer.org/download/).

```
composer require sentry/sentry-symfony
```

If you're using the [Symfony Flex](https://symfony.com/doc/current/setup/flex.html) Composer plugin, you might encounter a message similar to this:

```
The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/sentry/sentry-symfony/3.0

Do you want to execute this recipe?

```

Just type `y`, press return, and the procedure will continue.

**Caution:** Due to a bug in the [`SensioFrameworkExtra`](https://github.com/sensiolabs/SensioFrameworkExtraBundle) bundle, affecting version 6.0 and below, you might run into a missing `Nyholm\Psr7\Factory\Psr17Factory::class` error while executing the commands mentioned above. If you are not using the PSR-7 bridge, you can work around this issue by changing the configuration of the bundle as follows:

```
sensio_framework_extra:
   psr_message:
      enabled: false
```

For more details about the issue see [sensiolabs/SensioFrameworkExtraBundle#710](https://github.com/sensiolabs/SensioFrameworkExtraBundle/pull/710).

### Enable the Bundle

[](#enable-the-bundle)

If you installed the package using the Flex recipe, the bundle will be automatically enabled. Otherwise, enable it by adding it to the list of registered bundles in the `Kernel.php` file of your project:

```
class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
    public function registerBundles(): array
    {
        return [
            // ...
            new \Sentry\SentryBundle\SentryBundle(),
        ];
    }

    // ...
}
```

The bundle will be enabled in all environments by default. To enable event reporting, you'll need to add a DSN (see the next step).

### Configure

[](#configure)

Add the [Sentry DSN](https://docs.sentry.io/quickstart/#configure-the-dsn) of your project. If you're using Symfony 3.4, add the DSN to your `app/config/config_prod.yml` file. For Symfony 4 or newer, add the DSN to your `config/packages/sentry.yaml` file.

Keep in mind that by leaving the `dsn` value empty (or undeclared), you will disable Sentry's event reporting.

```
sentry:
    dsn: "https://public:secret@sentry.example.com/1"
    messenger:
        enabled: true # flushes Sentry messages at the end of each message handling
        capture_soft_fails: true # captures exceptions marked for retry too
    options:
        environment: '%kernel.environment%'
        release: '%env(VERSION)%' #your app version
```

The parameter `options` allows to fine-tune exceptions. To discover more options, please refer to [the Unified APIs](https://docs.sentry.io/development/sdk-dev/unified-api/#options) options and the [PHP specific](https://docs.sentry.io/platforms/php/#php-specific-options) ones.

#### Optional: use custom HTTP factory/transport

[](#optional-use-custom-http-factorytransport)

Since the SDK 2.0 uses HTTPlug to remain transport-agnostic, you need to install two packages that provide [`php-http/async-client-implementation`](https://packagist.org/providers/php-http/async-client-implementation)and [`psr/http-message-implementation`](https://packagist.org/providers/psr/http-message-implementation).

This bundle depends on `sentry/sdk`, which is a metapackage that already solves this need, requiring our suggested HTTP packages: the Symfony HTTP client (`symfony/http-client`) and Guzzle's message factories (`http-interop/http-factory-guzzle`).

If you want to use a different HTTP client or message factory, you can override the `sentry/sdk` package by adding the following to your `composer.json` after the `require` section:

```
    "replace": {
        "sentry/sdk": "*"
    }
```

For example when you want to use Guzzle's components:

```
composer require php-http/guzzle6-adapter guzzlehttp/psr7
```

If you don't have a compatible HTTP client and/or message factory implementation installed `php-http/discovery` will try to install it for you using a Composer plugin.

Maintained versions
-------------------

[](#maintained-versions)

- 4.x is actively maintained and developed on the master branch, and uses Sentry SDK 3.0;
- 3.x is supported only for fixes and uses Sentry SDK 2.0;
- 2.x is no longer maintained; from this version onwards it requires Symfony 3+ and PHP 7.1+;
- 1.x is no longer maintained; you can use it for Symfony &lt; 2.8 and PHP 5.6/7.0;
- 0.8.x is no longer maintained.

### Upgrading to 4.0

[](#upgrading-to-40)

The 4.0 version of the bundle uses the newest version (3.x) of the underlying Sentry SDK. If you need to migrate from previous versions, please check the `UPGRADE-4.0.md` document.

#### Custom serializers

[](#custom-serializers)

The option class\_serializers can be used to send customized objects serialization.

```
sentry:
    options:
        class_serializers:
            YourValueObject: 'ValueObjectSerializer'
```

Several serializers can be added and the serializable check is done by using the **instanceof** type operator. The serializer must implement the `__invoke` method, which needs to return an **array**, containing the information that should be send to Sentry. The class name is always sent by default.

Serializer example:

```
final class ValueObjectSerializer
{
    public function __invoke(YourValueObject $vo): array
    {
        return [
            'value' => $vo->value()
        ];
    }
}
```

Contributing to the SDK
-----------------------

[](#contributing-to-the-sdk)

Please refer to [CONTRIBUTING.md](CONTRIBUTING.md).

Getting help/support
--------------------

[](#getting-helpsupport)

If you need help setting up or configuring the Symfony SDK (or anything else in the Sentry universe) please head over to the [Sentry Community on Discord](https://discord.com/invite/Ww9hbqr). There is a ton of great people in our Discord community ready to help you!

Resources
---------

[](#resources)

- [![Documentation](https://camo.githubusercontent.com/89b631a7c9f547c7fff1464870c5b11aad560fe0cc1114774e8ea5addbc69f9e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d73656e7472792e696f2d677265656e2e737667)](https://docs.sentry.io/quickstart/)
- [![Discord](https://camo.githubusercontent.com/2da2973533965a9404e5ef0683e6cd8192988281f5860256076294e906b9c40c/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f363231373738383331363032323231303634)](https://discord.gg/Ww9hbqr)
- [![Stack Overflow](https://camo.githubusercontent.com/e69d3e4fed2234d76f0ebb262dc944f4abdf903ae1fea7688de7a3183ae42a49/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461636b2532306f766572666c6f772d73656e7472792d677265656e2e737667)](http://stackoverflow.com/questions/tagged/sentry)
- [![Twitter Follow](https://camo.githubusercontent.com/330d3aac03f6697a8a0d188c891131e5e89ce6e0829bda396fe78c43f4ebcd56/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f67657473656e7472793f6c6162656c3d67657473656e747279267374796c653d736f6369616c)](https://twitter.com/intent/follow?screen_name=getsentry)

License
-------

[](#license)

Licensed under the MIT license, see [`LICENSE`](LICENSE)

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance51

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 55.7% of commits — single point of failure

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 ~36 days

Recently: every ~77 days

Total

92

Last Release

339d ago

Major Versions

1.0.3 → 2.0.32018-06-01

2.3.0 → 3.0.0-beta12019-03-05

3.5.3 → 4.0.02021-01-19

3.5.4 → 4.1.22021-05-16

4.14.0 → 5.0.02024-04-09

PHP version history (5 changes)0.1.0PHP &gt;=5.2.4

0.2.0PHP &gt;=5.3.3

1.0PHP ^5.6|^7.0

2.0PHP ^7.1

4.0.0PHP ^7.2||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/119c17094392b89164e6e39e756be1d2de484b259a08a574a4652a2bed4caba9?d=identicon)[dbannik](/maintainers/dbannik)

---

Top Contributors

[![Jean85](https://avatars.githubusercontent.com/u/6729988?v=4)](https://github.com/Jean85 "Jean85 (426 commits)")[![ste93cry](https://avatars.githubusercontent.com/u/1770485?v=4)](https://github.com/ste93cry "ste93cry (90 commits)")[![cleptric](https://avatars.githubusercontent.com/u/6617432?v=4)](https://github.com/cleptric "cleptric (55 commits)")[![dcramer](https://avatars.githubusercontent.com/u/23610?v=4)](https://github.com/dcramer "dcramer (54 commits)")[![swquinn](https://avatars.githubusercontent.com/u/153358?v=4)](https://github.com/swquinn "swquinn (16 commits)")[![getsentry-bot](https://avatars.githubusercontent.com/u/10587625?v=4)](https://github.com/getsentry-bot "getsentry-bot (14 commits)")[![HazAT](https://avatars.githubusercontent.com/u/363802?v=4)](https://github.com/HazAT "HazAT (10 commits)")[![nocive](https://avatars.githubusercontent.com/u/651121?v=4)](https://github.com/nocive "nocive (9 commits)")[![stayallive](https://avatars.githubusercontent.com/u/1090754?v=4)](https://github.com/stayallive "stayallive (8 commits)")[![cklm](https://avatars.githubusercontent.com/u/466021?v=4)](https://github.com/cklm "cklm (8 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![Addvilz](https://avatars.githubusercontent.com/u/1390347?v=4)](https://github.com/Addvilz "Addvilz (7 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (5 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (5 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (5 commits)")[![rdohms](https://avatars.githubusercontent.com/u/94331?v=4)](https://github.com/rdohms "rdohms (4 commits)")[![server-may-cry](https://avatars.githubusercontent.com/u/5962057?v=4)](https://github.com/server-may-cry "server-may-cry (4 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (4 commits)")[![michaelzangerle](https://avatars.githubusercontent.com/u/1465587?v=4)](https://github.com/michaelzangerle "michaelzangerle (4 commits)")[![rjd22](https://avatars.githubusercontent.com/u/160743?v=4)](https://github.com/rjd22 "rjd22 (4 commits)")

---

Tags

symfonyloggingerrorssentry

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dbannik-sentry-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/dbannik-sentry-symfony/health.svg)](https://phpackages.com/packages/dbannik-sentry-symfony)
```

###  Alternatives

[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73761.4M65](/packages/sentry-sentry-symfony)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M151](/packages/sulu-sulu)

PHPackages © 2026

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