Error monitoring for Symfony.

With sentry/sentry-symfony, your Symfony application reports exceptions from controllers, commands and Messenger to Fehlo. The Flex recipe does most of the work.

As of 24 October 2026, sentry/sentry-symfony 5.14.0 with sentry/sentry 4.34, Symfony 5.4 to 8. We have not yet run the PHP SDK against Fehlo ourselves; it speaks the same protocol as the SDKs we tested.

1. Install the package

Terminal
composer require sentry/sentry-symfony

The Flex recipe registers the bundle in config/bundles.php for the prod environment only, and creates config/packages/sentry.yaml. The recipe lives in recipes-contrib; if Flex doesn't apply it, allow contrib recipes with composer config extra.symfony.allow-contrib true and install again.

2. Set the DSN

.env.local
###> sentry/sentry-symfony ###
SENTRY_DSN="https://<key>@app.fehlo.de/<project-id>"
###< sentry/sentry-symfony ###

In production, set SENTRY_DSN as a real environment variable. The recipe's configuration, with personal data switched off explicitly:

config/packages/sentry.yaml
when@prod:
    sentry:
        dsn: '%env(SENTRY_DSN)%'
        options:
            send_default_pii: false
            ignore_exceptions:
                - 'Symfony\Component\ErrorHandler\Error\FatalError'
                - 'Symfony\Component\Debug\Exception\FatalErrorException'

The environment comes from %kernel.environment%, the release from the SENTRY_RELEASE environment variable.

3. Test it

The bundle has a test command. Since it is only registered in prod, run it there:

Terminal
APP_ENV=prod php bin/console sentry:test

It answers "Message sent successfully with ID …", and the message appears in Fehlo. For a real stack trace, add a route that throws:

src/Controller/FehloTestController.php
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route;

class FehloTestController extends AbstractController
{
    #[Route('/_fehlo-test', name: 'fehlo_test')]
    public function test(): never
    {
        throw new \RuntimeException('Fehlo test error');
    }
}

Clear the cache after changing the YAML: APP_ENV=prod php bin/console cache:clear.

Monolog

To see log records from ERROR up as issues even when no exception is thrown, add the SDK's Monolog handler. Then switch off the bundle's error listener, or exceptions arrive twice:

config/packages/sentry.yaml
when@prod:
    sentry:
        register_error_listener: false
        register_error_handler: false

    monolog:
        handlers:
            sentry:
                type: service
                id: Sentry\Monolog\Handler

    services:
        Sentry\Monolog\Handler:
            arguments:
                $hub: '@Sentry\State\HubInterface'
                $level: !php/const Monolog\Logger::ERROR
                $fillExtraContext: true

Privacy

send_default_pii defaults to false: no headers, cookies, IP addresses or logged-in user. The request URL and query string are always sent. Since sentry/sentry 4.33 there is also data_collection. Don't set data_collection: once it is set, its more permissive defaults apply, and the SDK sends IP addresses, cookies and bodies. Fehlo strips the sender IP on the server and filters email addresses, passwords and tokens.

Questions

Why does nothing arrive in development?

The Flex recipe registers the bundle for prod only. To test locally, run the test command with APP_ENV=prod or register the bundle for all environments in config/bundles.php.

Does this work with Shopware?

Yes, Shopware is a Symfony application. For Shopware, add the Friends of Shopware bundle as well, see Shopware setup.

Nothing arrives. What should I check?

First the DSN: it has to point at app.fehlo.de. Second, whether your server or browser can reach https://app.fehlo.de (firewall, proxy, ad blocker). Third, whether this month's quota is used up; you get an email when it is. Fourth, whether sampleRate or beforeSend drops events. If only performance data is missing, this month's transactions may be used up.