- Can I use sentry/sentry-symfony in a Laravel application?
- Not natively. sentry/sentry-symfony is the official Symfony bundle and expects Symfony's bundle registration, dependency injection, and event system. The underlying sentry/sentry package is framework-agnostic and can be used directly in Laravel. Only adopt the Symfony bundle if your Laravel app also uses Symfony components and you are prepared to bridge configuration and integrations manually.
- How do I install sentry/sentry-symfony with Composer?
- Install it with composer require sentry/sentry-symfony. Add your Sentry DSN to the SENTRY_DSN environment variable in your .env file. In Symfony, Flex usually enables the bundle automatically; otherwise register it in config/bundles.php. Laravel will not auto-discover it as a Laravel package, so expect manual wiring if you try it there.
- How do I configure the Sentry DSN for sentry/sentry-symfony?
- Set SENTRY_DSN in your .env file, for example SENTRY_DSN=https://[email protected]/1. In Symfony, you can also map options through the bundle's YAML configuration. For Laravel, the practical path is to map the same environment value into config/sentry.php and initialize the core sentry/sentry SDK yourself.
- Does sentry/sentry-symfony support Laravel 10 and Laravel 11?
- There is no native Laravel support in sentry/sentry-symfony because it targets Symfony. The underlying sentry/sentry SDK is framework-agnostic and can be wired into Laravel 10 or 11 through App\Exceptions\Handler or a custom reporting service. Symfony-specific features such as Doctrine and Messenger auto-instrumentation will not work out of the box in Laravel. For most Laravel 10 and 11 applications, a Laravel-specific Sentry SDK or sentry/sentry directly is the safer choice.
- What features does sentry/sentry-symfony add beyond basic error tracking?
- It supports exception capture, breadcrumbs, distributed tracing, structured logging, metrics, OTLP integration, and CLI command tracking. As a Symfony bundle, it also adds auto-instrumentation for Symfony HTTP, Doctrine, Messenger, Cache, and related components. In Laravel, many of those Symfony-specific integrations require manual implementation or must be disabled.
- Should Laravel teams use sentry/sentry-symfony or sentry/sentry?
- For a Laravel-centric application, use sentry/sentry directly or a Laravel-specific Sentry SDK rather than the Symfony bundle. Choose sentry/sentry-symfony only if your app genuinely uses Symfony components such as Messenger or Doctrine and you need the bundle's auto-instrumentation. This avoids unnecessary Symfony dependencies and keeps configuration aligned with Laravel conventions.
- How do I capture exceptions in Laravel if I install sentry/sentry-symfony?
- Use the underlying Sentry\captureException function from the sentry/sentry dependency inside App\Exceptions\Handler or your report method. Initialize the SDK with your DSN during application boot. Do not rely on the Symfony bundle's kernel exception listener to handle Laravel exceptions automatically. For queue jobs, wrap execution with Sentry\init or use a custom queue listener to isolate context.
- How can I test Sentry error reporting in a Laravel app?
- In Laravel tests, use the core sentry/sentry SDK with a null DSN or a mocked transport so real events are not sent. Assert that your exception handler or reporting service calls Sentry capture logic for expected exceptions. If you are testing the Symfony bundle itself, disable it in the test environment or use its test configuration options. This keeps test suites fast and prevents noisy Sentry projects.
- What production risks should I consider with sentry/sentry-symfony?
- Auto-instrumentation for cache, Doctrine, Messenger, and tracing adds runtime hooks and can introduce overhead, so enable optional integrations selectively. Version 5.0.0 requires envelope endpoint support and removed traceparent support, which is a blocker for self-hosted Sentry older than 20.6.0. The Symfony bundle can also pull in optional dependencies that are unnecessary in a Laravel app. Review sampling, integration flags, and dependency footprint before production rollout.
- Is sentry/sentry-symfony actively maintained and what alternatives exist?
- Yes, it is a first-party Sentry SDK with ongoing releases and upgrade guides, though major versions such as 5.0.0 can include breaking changes. For Laravel, the main alternatives are sentry/sentry directly, a Laravel-specific Sentry SDK, or another observability platform. Pin your Composer versions and review the Sentry upgrade notes before moving major versions.