PHPackages                             reasno/zipkin-opentracing - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. reasno/zipkin-opentracing

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

reasno/zipkin-opentracing
=========================

A Zipkin bridge with OpenTracing

0.1.3(6y ago)00MITPHP

Since Mar 21Pushed 5y agoCompare

[ Source](https://github.com/Reasno/zipkin-php-opentracing)[ Packagist](https://packagist.org/packages/reasno/zipkin-opentracing)[ RSS](/packages/reasno-zipkin-opentracing/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (7)Used By (0)

Zipkin PHP OpenTracing
======================

[](#zipkin-php-opentracing)

[![Travis CI](https://camo.githubusercontent.com/6dbd4bf2682b737f21deb0a0e513c4f42e69aab3c1694d1c2bebdea77e0f57b7/68747470733a2f2f7472617669732d63692e6f72672f6a6363686176657a732f7a69706b696e2d7068702d6f70656e74726163696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jcchavezs/zipkin-php-opentracing)[![OpenTracing Badge](https://camo.githubusercontent.com/0c34d42089573bfc38911b30f4fd5c7d3ef20dd05d0849b390643ccbf19695da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e54726163696e672d656e61626c65642d626c75652e737667)](http://opentracing.io)[![Total Downloads](https://camo.githubusercontent.com/e3cb124864aacaab878b924e094a92a94083ba316af612154052027606ca050f/68747470733a2f2f706f7365722e707567782e6f72672f6a6363686176657a732f7a69706b696e2d6f70656e74726163696e672f646f776e6c6f616473)](https://packagist.org/packages/jcchavezs/zipkin-opentracing)[![Minimum PHP Version](https://camo.githubusercontent.com/824c5c4ccb56537db3b3b53bb43d7b8edc6286f3b3d1705525e0821dfd22d27e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/3ebc885666f5d0d2b5e065729811446970dd4621e9b8459bc3fdf0a4f7f0cea8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a6363686176657a732f7a69706b696e2d6f70656e74726163696e672e737667)](https://github.com/jcchavezs/zipkin-php-opentracing/blob/master/LICENSE)

[Zipkin](http://zipkin.io) implementation for OpenTracingTracer in PHP.

This library allows OpenTracing API consumers to use Zipkin as their tracing backend. For details on how to work with spans and traces we suggest looking at the documentation and README from the [OpenTracing API](https://github.com/opentracing/opentracing-php).

Getting started
---------------

[](#getting-started)

### Required Reading

[](#required-reading)

In order to understand OpenTracing API, one must first be familiar with the [OpenTracing project](http://opentracing.io) and [terminology](http://opentracing.io/spec/) more generally.

To understand how Zipkin works, you can look at [Zipkin Architecture](http://zipkin.io/pages/architecture.html) and [Zipkin PHP](https://github.com/zipkin/zipkin-php) documentation.

### Installation

[](#installation)

```
composer require jcchavezs/zipkin-opentracing
```

### Usage

[](#usage)

Firstly, we need to setup a tracer:

```
use OpenTracing\GlobalTracer;
use Psr\Log\NullLogger;
use Zipkin\Endpoint;
use Zipkin\Samplers\BinarySampler;
use Zipkin\TracingBuilder;
use Zipkin\Reporters\Http;

$endpoint = Endpoint::create('my_service', '127.0.0.1', null, 8081);
$reporter = new Zipkin\Reporters\Http();
$sampler = BinarySampler::createAsAlwaysSample();
$tracing = TracingBuilder::create()
	->havingLocalEndpoint($endpoint)
   ->havingSampler($sampler)
   ->havingReporter($reporter)
   ->build();

$zipkinTracer = new ZipkinOpenTracing\Tracer($tracing);

GlobalTracer::set($zipkinTracer); // optional
```

### Creating Spans

[](#creating-spans)

- [Starting a root span](https://github.com/opentracing/opentracing-php#starting-an-empty-trace-by-creating-a-root-span)
- [Starting a span for a given request](https://github.com/opentracing/opentracing-php#creating-a-span-given-an-existing-request)
- [Active span and scope manager](https://github.com/opentracing/opentracing-php#active-spans-and-scope-manager)
    - [Creating a child span assigning parent manually](https://github.com/opentracing/opentracing-php#creating-a-child-span-assigning-parent-manually)
    - [Creating a child span using automatic active span management](https://github.com/opentracing/opentracing-php#creating-a-child-span-using-automatic-active-span-management)
- [Using span options](https://github.com/opentracing/opentracing-php#using-span-options)

### Propagation of context

[](#propagation-of-context)

- [Serializing context to the wire](https://github.com/opentracing/opentracing-php#serializing-to-the-wire)
- [Deserializing context from the wire](https://github.com/opentracing/opentracing-php#deserializing-from-the-wire)
- [Propagation formats](https://github.com/opentracing/opentracing-php#propagation-formats)

### Flushing Spans to the agent

[](#flushing-spans-to-the-agent)

PHP as a request scoped language has no simple means to pass the collected spans data to a background process without blocking the main request thread/process. It is mandatory to execute the `Tracer::flush()` after the response is served to the client by using [`register_shutdown_function`](http://php.net/manual/en/function.register-shutdown-function.php).

```
use OpenTracing\GlobalTracer;

$application->run();

register_shutdown_function(function() {
    GlobalTracer::get()->flush();
});
```

Contribution
------------

[](#contribution)

### Run tests

[](#run-tests)

```
composer test

```

### Fix lint

[](#fix-lint)

```
composer fix-lint

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.9% 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 ~177 days

Total

4

Last Release

2427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7af73177d27773a882385657d18105ac6dbe5eddf81ff883495bf4edd70f14?d=identicon)[Reasno](/maintainers/Reasno)

---

Top Contributors

[![jcchavezs](https://avatars.githubusercontent.com/u/3075074?v=4)](https://github.com/jcchavezs "jcchavezs (39 commits)")[![eligijusvitkauskas-home24](https://avatars.githubusercontent.com/u/36626058?v=4)](https://github.com/eligijusvitkauskas-home24 "eligijusvitkauskas-home24 (11 commits)")[![alexeyshockov](https://avatars.githubusercontent.com/u/203120?v=4)](https://github.com/alexeyshockov "alexeyshockov (8 commits)")[![cjone0102](https://avatars.githubusercontent.com/u/60937477?v=4)](https://github.com/cjone0102 "cjone0102 (5 commits)")[![ellisv](https://avatars.githubusercontent.com/u/3896844?v=4)](https://github.com/ellisv "ellisv (4 commits)")[![Reasno](https://avatars.githubusercontent.com/u/3881629?v=4)](https://github.com/Reasno "Reasno (2 commits)")[![johanneskonst](https://avatars.githubusercontent.com/u/1047641?v=4)](https://github.com/johanneskonst "johanneskonst (1 commits)")[![lpf32](https://avatars.githubusercontent.com/u/6958020?v=4)](https://github.com/lpf32 "lpf32 (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/reasno-zipkin-opentracing/health.svg)

```
[![Health](https://phpackages.com/badges/reasno-zipkin-opentracing/health.svg)](https://phpackages.com/packages/reasno-zipkin-opentracing)
```

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)[beyondcode/helo-laravel

HELO Laravel debug helper

90360.1k](/packages/beyondcode-helo-laravel)

PHPackages © 2026

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