Search by

cyve / phpunit-opentelemetry-extension

cyve

PHPUnit extension for test tracing

Package info

github.com/cyve/phpunit-opentelemetry-extension

pkg:composer/cyve/phpunit-opentelemetry-extension

Statistics

Installs: 16

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-11-23 20:29 UTC

This package is auto-updated.

Last update: 2026-11-23 20:30:46 UTC


README

PHPUnit extension for test tracing

Installation

composer require --dev cyve/phpunit-opentelemetry-extension open-telemetry/exporter-otlp

open-telemetry/exporter-otlp required a PSR-17 and PSR-18 implementations. If you do not already have one in your application, we suggest :

composer require --dev nyholm/psr7 symfony/http-client

Configuration

# phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
   <!-- ... -->
    <extensions>
        <bootstrap class="Cyve\OpenTelemetry\Phpunit\OpenTelemetryExtension"/>
    </extensions>
</phpunit>
# .env.test
OTEL_SERVICE_NAME=service
OTEL_EXPORTER_OTLP_PROTOCOL=http/json
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
  • OTEL_SERVICE_NAME is the name of your application
  • OTEL_EXPORTER_OTLP_PROTOCOL is any OTEL protocol
  • OTEL_EXPORTER_OTLP_ENDPOINT is the storage endpoint (ex: Jaeger)

Usage

Run PHPUnit tests as usual.