PHPackages                             tbachert/otel-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tbachert/otel-sdk

ActiveMetapackage[Utility &amp; Helpers](/categories/utility)

tbachert/otel-sdk
=================

OpenTelemetry SDK

078

Since Jan 27Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Nevay/otel-sdk)[ Packagist](https://packagist.org/packages/tbachert/otel-sdk)[ RSS](/packages/tbachert-otel-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

OpenTelemetry SDK
=================

[](#opentelemetry-sdk)

Asynchronous OpenTelemetry SDK based on [Revolt](https://revolt.run/).

This metapackage contains the basic components that are required for creating traces/metrics/logs through the official [OpenTelemetry API](https://packagist.org/packages/open-telemetry/api) and sending them to an [`OTLP/HTTP`](https://opentelemetry.io/docs/specs/otlp/#otlphttp)compatible collector[1](#user-content-fn-1-0bdfedfc124633e27797459b53aebc16). Additional components (e.g. non-OTLP exporters) can be installed as separate packages.

Projects using [ReactPHP](https://reactphp.org/) libraries can use this SDK together with [`revolt/event-loop-adapter-react`](https://github.com/revoltphp/event-loop-adapter-react).

Installation
------------

[](#installation)

```
composer require tbachert/otel-sdk
```

Usage
-----

[](#usage)

Refer to the [official OpenTelemetry documentation](https://opentelemetry.io/docs/instrumentation/php/) for general usage of the OpenTelemetry API.

### Initialization from [configuration file](https://opentelemetry.io/docs/specs/otel/configuration/data-model/#file-based-configuration-model)

[](#initialization-from-configuration-file)

```
$config = Config::loadFile(__DIR__ . '/sdk-config.yaml');
```

###### Automatic initialization from configuration file

[](#automatic-initialization-from-configuration-file)

The [`OTEL_EXPERIMENTAL_CONFIG_FILE`](https://opentelemetry.io/docs/languages/php/sdk/#configuration) environment variable can be set to initialize the `Global` instances on startup.

### Initialization from [environment variables](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/)

[](#initialization-from-environment-variables)

```
$config = Config::loadFromEnv();
```

###### Automatic initialization from environment variables

[](#automatic-initialization-from-environment-variables)

The [`OTEL_PHP_AUTOLOAD_ENABLED`](https://opentelemetry.io/docs/languages/php/sdk/#configuration) environment variable can be set to `true` to initialize the `Global` instances on startup.

### Manual SDK initialization

[](#manual-sdk-initialization)

```
$resource = Resource::create(['foo' => 'bar']);

$tracerProvider = (new TracerProviderBuilder())
    ->setResource($resource)
    ->addSpanProcessor(new BatchSpanProcessor(new OtlpStreamSpanExporter(getStdout())))
    ->build($logger);
$meterProvider = (new MeterProviderBuilder())
    ->setResource($resource)
    ->addMetricReader(new PeriodicExportingMetricReader(new OtlpStreamMetricExporter(getStdout())))
    ->build($logger);
$loggerProvider = (new LoggerProviderBuilder())
    ->setResource($resource)
    ->addLogRecordProcessor(new BatchLogRecordProcessor(new OtlpStreamLogRecordExporter(getStdout())))
    ->build($logger);
```

```
$cancellation = new TimeoutCancellation(10);
await([
    async($tracerProvider->shutdown(...), $cancellation),
    async($meterProvider->shutdown(...), $cancellation),
    async($loggerProvider->shutdown(...), $cancellation),
]);
```

Footnotes
---------

1. It is highly recommended to install the [`ext-protobuf`](https://opentelemetry.io/docs/instrumentation/php/#ext-protobuf) extension if using one of the `OTLP` exporters due to its significantly better performance. [↩](#user-content-fnref-1-0bdfedfc124633e27797459b53aebc16)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d96445384720ee37aa71d5ddd7b5a5d159558200b15b8a1b14e65e6095f2a7a?d=identicon)[tbachert](/maintainers/tbachert)

---

Top Contributors

[![Nevay](https://avatars.githubusercontent.com/u/22509671?v=4)](https://github.com/Nevay "Nevay (18 commits)")

### Embed Badge

![Health badge](/badges/tbachert-otel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/tbachert-otel-sdk/health.svg)](https://phpackages.com/packages/tbachert-otel-sdk)
```

###  Alternatives

[bitwasp/buffertools

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

65764.4k41](/packages/bitwasp-buffertools)[reefki/laravel-device-detector

Laravel wrapper for Matomo's Universal Device Detection library.

2852.6k](/packages/reefki-laravel-device-detector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
