Php
<!-- status: ga language: php -->
PHP: zero-code instrumentation
The OpenTelemetry PHP extension hooks function calls at runtime, so framework packages instrument Laravel, Symfony, Slim, PDO and PSR-18 clients without a code change. Nothing Watchtower-specific is installed: it reads the standard OTEL_* variables.
Create a project, then an ingestion key (
wti_...) with theingest:tracesscope. The key is shown once.Point the SDK at the gateway and pass the key in the
x-watchtower-keyheader:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.example.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS=x-watchtower-key=wti_YOUR_KEY
export OTEL_SERVICE_NAME=my-service
export OTEL_PHP_AUTOLOAD_ENABLED=trueInstall the extension and the packages, then enable the extension in
php.ini(extension=opentelemetry):
pecl install opentelemetry
composer require open-telemetry/sdk open-telemetry/exporter-otlp open-telemetry/opentelemetry-auto-laravel
php -S 0.0.0.0:8080 -t publicSwap opentelemetry-auto-laravel for the package of your framework (-symfony, -slim, -psr18, -pdo).
Send one request to the service, then open the project's onboarding screen: it turns green when the first span arrives.