The OpenTelemetry Symfony Bundle is distributed as a standard Composer package and registered automatically when Symfony Flex is present. The core bundle has no optional runtime dependencies beyond the OpenTelemetry PHP SDK — additional packages unlock specific exporters and transports. Follow the steps below to go from a fresh Symfony project to a fully wired OTel setup.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tracewayapp/opentelemetry-symfony-bundle/llms.txt
Use this file to discover all available pages before exploring further.
Installation Steps
Require the package via Composer
Run the following command in your project root:This installs the bundle along with its required dependencies: the OpenTelemetry PHP SDK (
open-telemetry/sdk), the OTel API, context propagation, and semantic conventions packages.Register the bundle
If your project uses Symfony Flex, the bundle is registered in
config/bundles.php automatically — no further action needed.Without Flex, add the bundle to config/bundles.php manually:Install the OTLP exporter
The OTLP exporter is the standard way to ship traces to any OpenTelemetry-compatible backend. Install it alongside a PSR-18 HTTP client:
The
open-telemetry/exporter-otlp package is listed as a suggestion in composer.json because the bundle supports multiple exporter backends. You only need this package if you are exporting via OTLP (the most common and recommended option).Optional Dependencies
The bundle activates additional instrumentation automatically when optional packages are detected. None of these are required for the core tracing pipeline.| Package | Purpose |
|---|---|
open-telemetry/contrib-aws | Native AWS X-Ray support (propagator: xray and id_generator: xray config keys) |
open-telemetry/exporter-otlp | Export traces, metrics, and logs via OTLP (most common backend protocol) |
php-http/guzzle7-adapter | HTTP transport for the OTLP exporter (or use any PSR-18 client) |
ext-protobuf | Significantly faster protobuf serialization for OTLP export |
ext-grpc | Required for the gRPC OTLP transport |
open-telemetry/transport-grpc | PHP-side gRPC transport layer (also requires ext-grpc) |
doctrine/dbal | Automatic Doctrine DBAL query tracing (^3.6 or ^4.0) |
symfony/cache | Automatic cache pool tracing (get / delete / invalidateTags) |
symfony/http-client | Automatic outgoing HttpClient request tracing |
symfony/mailer | Automatic Mailer instrumentation with PRODUCER and CLIENT spans |
symfony/messenger | Automatic Messenger job tracing with async context propagation |
symfony/scheduler | Automatic Scheduler tracing for RecurringMessage execution |
twig/twig | Automatic Twig template rendering tracing |
monolog/monolog | Log-trace correlation and OTel Logs API export |
symfony/monolog-bundle | Required when log_export_enabled: true — wires OtelLogHandler into Monolog |
PHP and Symfony Version Requirements
The bundle’scomposer.json specifies the following minimum versions:
| Dependency | Supported Versions |
|---|---|
| PHP | >= 8.1 |
| Symfony components | ^6.4 || ^7.0 || ^8.0 |
open-telemetry/sdk | ^1.14 |
open-telemetry/api | ^1.9 |
| Doctrine DBAL (optional) | ^3.6 || ^4.0 |
gRPC Transport
The gRPC OTLP transport is an alternative to HTTP/JSON and HTTP/Protobuf that can offer lower overhead in high-throughput environments. It requires both a PHP extension and a Composer package.Install the PHP extension
The
ext-grpc extension must be installed and enabled in your PHP environment:A Note on ext-protobuf
The ext-protobuf C extension is not required for the bundle to work, but it is strongly recommended for production deployments when using OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf. Without it, the PHP-native protobuf implementation is used, which is significantly slower under load.
