PHPackages                             eerzho/opentelemetry-auto-class-laravel - 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. eerzho/opentelemetry-auto-class-laravel

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

eerzho/opentelemetry-auto-class-laravel
=======================================

Laravel integration for automatic OpenTelemetry tracing via the #\[Traceable\] attribute

v0.1.3(1mo ago)00MITPHPPHP &gt;=8.2

Since Apr 20Pushed 5d agoCompare

[ Source](https://github.com/eerzho/opentelemetry-auto-class-laravel)[ Packagist](https://packagist.org/packages/eerzho/opentelemetry-auto-class-laravel)[ RSS](/packages/eerzho-opentelemetry-auto-class-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

opentelemetry-auto-class-laravel
================================

[](#opentelemetry-auto-class-laravel)

[![Version](https://camo.githubusercontent.com/12f38a8ba6f05a685b1f6b323c88c2fdc5318cd984b870807930c7d6cf5f370b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d6c61726176656c)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-laravel)[![Downloads](https://camo.githubusercontent.com/ab099fb231a380185d8cbac6246239c6ccd833e0f455fd566c9e460547a98251/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d6c61726176656c)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-laravel)[![PHP](https://camo.githubusercontent.com/3553c46e64ae139d09d3e5e366a1300991616806dcd50aabc008e45af5804c75/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d6c61726176656c2f706870)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-laravel)[![License](https://camo.githubusercontent.com/973ba3456d0b9e84e7de85e9e96353fe1c9a3502ca2ab2d0886ac59642240dfb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6565727a686f2f6f70656e74656c656d657472792d6175746f2d636c6173732d6c61726176656c)](https://packagist.org/packages/eerzho/opentelemetry-auto-class-laravel)

Laravel integration for automatic OpenTelemetry tracing of PHP methods via the `#[Traceable]` attribute. All classes with the attribute in configured namespaces are instrumented automatically using the `ext-opentelemetry` hook API.

This is a read-only sub-split. Please open issues and pull requests in the [monorepo](https://github.com/eerzho/opentelemetry-auto-class-monorepo).

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

[](#installation)

```
composer require eerzho/opentelemetry-auto-class-laravel
```

Optionally, publish the configuration to customize scanned namespaces (default is `App\`):

```
php artisan vendor:publish --tag=traceable-config
```

```
// config/traceable.php
return [
    'namespaces' => [
        'App\\Services\\',
        'App\\Jobs\\',
        'Domain\\',
    ],
];
```

Requirements:

- [ext-opentelemetry](https://opentelemetry.io/docs/zero-code/php/)
- PHP 8.2+
- Laravel 10+

Usage
-----

[](#usage)

### Basic

[](#basic)

Add `#[Traceable]` to a class in the configured namespaces — all public methods will be traced automatically:

```
namespace App\Services;

use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable]
class OrderService
{
    public function create(array $items): void
    {
        // span "App\Services\OrderService::create" is created automatically
    }

    public function cancel(int $orderId): void
    {
        // span "App\Services\OrderService::cancel" is created automatically
    }
}
```

> Make sure to run `composer dump-autoload -o` so that all classes appear in the class map.

> For full details on how spans are created, argument serialization, and limitations, see [opentelemetry-auto-class](https://github.com/eerzho/opentelemetry-auto-class).

### Exclude methods

[](#exclude-methods)

Use the `exclude` parameter to skip specific methods from tracing:

```
namespace App\Services;

use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable(exclude: ['healthCheck', 'getVersion'])]
class PaymentService
{
    public function charge(int $amount, string $currency): void
    {
        // traced
    }

    public function healthCheck(): bool
    {
        // NOT traced
        return true;
    }

    public function getVersion(): string
    {
        // NOT traced
        return '1.0.0';
    }
}
```

### Exclude arguments

[](#exclude-arguments)

By default, all method arguments are captured as span attributes. Use `#[Arguments(exclude: [...])]` on a method to hide sensitive parameters:

```
namespace App\Services;

use Eerzho\Instrumentation\Class\Attribute\Arguments;
use Eerzho\Instrumentation\Class\Attribute\Traceable;

#[Traceable]
class AuthService
{
    #[Arguments(exclude: ['password', 'token'])]
    public function login(string $email, string $password, string $token): void
    {
        // span captures "email" attribute only
        // "password" and "token" are excluded
    }

    public function logout(int $userId): void
    {
        // span captures "userId" attribute (no exclusions)
    }
}
```

How it works
------------

[](#how-it-works)

1. On boot, the service provider reads namespaces from `config/traceable.php`
2. Discovers all classes in those namespaces via Composer's `ClassLoader::getClassMap()`
3. Scans discovered classes for `#[Traceable]` attribute
4. Registers `ext-opentelemetry` hooks for matched methods

Disabling instrumentation
-------------------------

[](#disabling-instrumentation)

To disable tracing at runtime, use the standard OpenTelemetry environment variable:

```
OTEL_PHP_DISABLED_INSTRUMENTATIONS=class
```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance95

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

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

4

Last Release

50d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f1db695a51a4fcdbee1067af7f1bdbd1bfd11916789994f36d3b2ba2b2e4466?d=identicon)[eerzho](/maintainers/eerzho)

---

Top Contributors

[![eerzho](https://avatars.githubusercontent.com/u/56928699?v=4)](https://github.com/eerzho "eerzho (5 commits)")

---

Tags

apmauto-instrumentationdistributed-tracinginstrumentationlaravellaravel-packagemonitoringobservabilityopentelemetryotelphp-attributesspanstelemetrytracestracinglaravelmonitoringlaravel-packageapmtracingopentelemetryoteltelemetryobservabilityinstrumentationdistributed-tracingtracesphp-attributesspansauto-instrumentation

### Embed Badge

![Health badge](/badges/eerzho-opentelemetry-auto-class-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/eerzho-opentelemetry-auto-class-laravel/health.svg)](https://phpackages.com/packages/eerzho-opentelemetry-auto-class-laravel)
```

###  Alternatives

[open-telemetry/opentelemetry-auto-laravel

OpenTelemetry auto-instrumentation for Laravel

582.4M8](/packages/open-telemetry-opentelemetry-auto-laravel)[open-telemetry/opentelemetry-auto-symfony

OpenTelemetry auto-instrumentation for Symfony

561.5M3](/packages/open-telemetry-opentelemetry-auto-symfony)[open-telemetry/opentelemetry-auto-wordpress

OpenTelemetry auto-instrumentation for Wordpress

17194.7k](/packages/open-telemetry-opentelemetry-auto-wordpress)

PHPackages © 2026

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