Download the PHP package eerzho/opentelemetry-auto-class without Composer

On this page you can find all versions of the php package eerzho/opentelemetry-auto-class. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package opentelemetry-auto-class

opentelemetry-auto-class

Version Downloads PHP License

Trace what your methods received, returned, and threw — without writing a single span. No framework required.

This is a read-only sub-split. Please open issues and pull requests in the monorepo.

The framework-agnostic engine — the Laravel and Symfony integrations build on it to discover and register your classes automatically.

Installation

Requirements:

Usage

Start with a plain service — we'll add tracing to it one attribute at a time:

1. #[Trace] — mark a class for tracing

2. #[TraceMethod] — trace a method

A method gets a span with #[TraceMethod]. By default, it captures the arguments and the return value, and records exceptions. Turn each off with arguments: false, return: false, or exception: false (a disabled exception still sets the span status to ERROR, only its event is omitted).

3. #[TraceProperties] — expand an object argument

4. Register

Once the attributes are in place, scan the classes and register the hooks — once, at bootstrap:

Manual registration

Skip AttributeScanner and hand register() the method map directly:

Each method maps to its arguments (name => position) plus the return and exception flags. Missing keys default to off. Anything not listed is not traced.

Traced output

Selecting what to trace

include and exclude behave the same wherever they appear — #[TraceMethod] (arguments) and #[TraceProperties] (properties):

include exclude Result
[] [] Everything (default)
[a, b] [] Only a and b
[] [a] Everything except a
[a, b] [b] Only a — exclude wins on conflict

An empty include means "no allowlist" (everything), not "nothing".

All properties are expanded — use exclude to drop sensitive ones (tokens, hashes).

Argument serialization

Each captured argument is serialized to a span-compatible value:

Type Result
string, int, float, bool As-is
null "null"
BackedEnum Backing value
DateTimeInterface RFC3339 with milliseconds
Object with #[TraceProperties] Expanded properties
Object with __toString() String cast
Object without #[TraceProperties] and __toString() Class name (FQCN)
array First element sampled + array_count
Other (resource, ...) gettype() result

Object expansion via #[TraceProperties]:

Array expansion:

Span structure

Each traced call produces an INTERNAL span named ClassName::methodName, with:

Attribute Value
code.function.name ClassName::methodName
code.file.path File where the method is defined
code.line.number Line number of the method
code.return Return value, serialized the same way
code.argument.{name} Method argument, keyed by parameter name, serialized the same way

If the method throws, the span records an exception event and its status is set to ERROR:

Event attribute Value
exception.type Exception class name
exception.message Exception message
exception.stacktrace Full stack trace

With exception: false the status still becomes ERROR, but the event above is omitted.

How it works

AttributeScanner::scan() reflects over the classes you pass it:

  1. Skips abstract classes, interfaces, traits, and enums.
  2. Reads #[Trace] on the class — no attribute, no instrumentation.
  3. Collects every method carrying #[TraceMethod], and for each the arguments, return value, and exception recording it configures.

It returns a class → method → {arguments, return, exception} map. ClassInstrumentation::register() then installs an ext-opentelemetry hook on every mapped method:

Disabling instrumentation


All versions of opentelemetry-auto-class with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-opentelemetry Version *
open-telemetry/api Version ^1.0
open-telemetry/sem-conv Version ^1.33
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eerzho/opentelemetry-auto-class contains the following files

Loading the files please wait ...