PHPackages                             iqlearning/laravel-otel - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. iqlearning/laravel-otel

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

iqlearning/laravel-otel
=======================

Laravel integration for OpenTelemetry with dual exporters (Jaeger &amp; Zipkin) using JSON protocol

v0.2(4mo ago)01MITPHPPHP ^8.1

Since Jan 9Pushed 4mo agoCompare

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

READMEChangelog (1)Dependencies (8)Versions (4)Used By (0)

Laravel OpenTelemetry Package
=============================

[](#laravel-opentelemetry-package)

[![Latest Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://github.com/antigravity/laravel-otel)[![PHP Version](https://camo.githubusercontent.com/5c9ed36807c6dd9d199e222d90b70b33a8073a27d76a4fca70cf5cc460ec0650/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d707572706c652e737667)](https://www.php.net/)[![Laravel Version](https://camo.githubusercontent.com/5d95ef60d543b9429c1384f785d98a1cfed1cad640180939b52b30ca1840e66e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025323025374325323025354531312e302d7265642e737667)](https://laravel.com/)

A Laravel package providing OpenTelemetry integration with dual exporters for Jaeger and Zipkin using the JSON protocol.

Features
--------

[](#features)

- ✅ **Dual Exporters**: Send traces to both Jaeger and Zipkin simultaneously
- ✅ **JSON Protocol**: OTLP HTTP JSON for Jaeger, HTTP JSON for Zipkin
- ✅ **Auto-Discovery**: Automatic service provider registration
- ✅ **Flexible Sampling**: Support for multiple sampling strategies
- ✅ **Easy Configuration**: Environment-based configuration
- ✅ **Laravel Integration**: Native Laravel service provider

Disclaimer
----------

[](#disclaimer)

- Made with Google Antigravity
- Be extra cautious using this package for possible security vulnerability

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require iqlearning/laravel-otel
```

### 2. Publish Configuration

[](#2-publish-configuration)

```
php artisan vendor:publish --provider="Iqlearning\LaravelOtel\OpenTelemetryServiceProvider"
```

This will publish the `config/opentelemetry.php` configuration file.

### 3. Configure Environment Variables

[](#3-configure-environment-variables)

Add the following to your `.env` file:

```
# OpenTelemetry Configuration
OTEL_SERVICE_NAME=your-app-name
OTEL_SERVICE_VERSION=1.0.0
OTEL_EXPORTER_TYPE=both
OTEL_EXPORTER_OTLP_PROTOCOL=http/json

# Jaeger Exporter
OTEL_EXPORTER_JAEGER_ENABLED=true
OTEL_EXPORTER_JAEGER_ENDPOINT=http://localhost:4318/v1/traces

# Zipkin Exporter
OTEL_EXPORTER_ZIPKIN_ENABLED=true
OTEL_EXPORTER_ZIPKIN_ENDPOINT=http://localhost:9411/api/v2/spans

# Trace Sampling
OTEL_TRACES_SAMPLER=always_on
OTEL_TRACES_SAMPLER_ARG=1.0
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

The package automatically registers the OpenTelemetry service provider. Simply inject the `TracerInterface` into your classes:

```
use OpenTelemetry\API\Trace\TracerInterface;

class YourController extends Controller
{
    public function __construct(
        private TracerInterface $tracer
    ) {}

    public function yourMethod()
    {
        $span = $this->tracer
            ->spanBuilder('your.operation')
            ->startSpan();

        try {
            // Your business logic
            $result = $this->doSomething();

            $span->addEvent('operation.completed');

            return $result;
        } finally {
            $span->end();
        }
    }
}
```

### Configuration

[](#configuration)

#### Exporter Selection

[](#exporter-selection)

Choose which exporter(s) to use:

```
# Use only Jaeger
OTEL_EXPORTER_TYPE=jaeger

# Use only Zipkin
OTEL_EXPORTER_TYPE=zipkin

# Use both (default)
OTEL_EXPORTER_TYPE=both
```

#### Sampling Strategies

[](#sampling-strategies)

Control which traces are collected:

```
# Sample all traces (development)
OTEL_TRACES_SAMPLER=always_on

# Sample no traces
OTEL_TRACES_SAMPLER=always_off

# Sample 10% of traces (production)
OTEL_TRACES_SAMPLER=traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1
```

Infrastructure Setup
--------------------

[](#infrastructure-setup)

### Docker Compose

[](#docker-compose)

Create a `docker-compose.yml` file:

```
services:
    jaeger:
        image: jaegertracing/all-in-one:latest
        environment:
            - COLLECTOR_OTLP_ENABLED=true
        ports:
            - "16686:16686" # Jaeger UI
            - "4318:4318" # OTLP HTTP receiver

    zipkin:
        image: openzipkin/zipkin:latest
        ports:
            - "9411:9411" # Zipkin UI and API
```

Start the services:

```
docker-compose up -d
```

### Viewing Traces

[](#viewing-traces)

- **Jaeger UI**:
- **Zipkin UI**:

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.0 or 11.0
- OpenTelemetry PHP Extension (for auto-instrumentation)

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Support
-------

[](#support)

For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/antigravity/laravel-otel).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance78

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

122d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e647a586372e5f812419b6253a2836e61a016f105d5cbc76ef208f2b65d9f949?d=identicon)[iqlearning](/maintainers/iqlearning)

---

Top Contributors

[![iqlearning](https://avatars.githubusercontent.com/u/253889891?v=4)](https://github.com/iqlearning "iqlearning (6 commits)")

---

Tags

laravelmonitoringapmtracingopentelemetryobservabilityjaegerzipkin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iqlearning-laravel-otel/health.svg)

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

###  Alternatives

[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

142347.8k](/packages/keepsuit-laravel-opentelemetry)[vinelab/tracing-laravel

Distributed tracing for Laravel made easy

80118.7k1](/packages/vinelab-tracing-laravel)

PHPackages © 2026

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