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

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

jcchavezs/zipkin-opentracing
============================

A Zipkin bridge with OpenTracing

2.0.4(2y ago)242.9M↓11.8%22[2 issues](https://github.com/jcchavezs/zipkin-php-opentracing/issues)[1 PRs](https://github.com/jcchavezs/zipkin-php-opentracing/pulls)12MITPHPPHP &gt;=7.4 || ^8.0CI failing

Since Apr 5Pushed 2y ago2 watchersCompare

[ Source](https://github.com/jcchavezs/zipkin-php-opentracing)[ Packagist](https://packagist.org/packages/jcchavezs/zipkin-opentracing)[ Fund](https://www.paypal.me/jcchavezs)[ RSS](/packages/jcchavezs-zipkin-opentracing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (17)Used By (12)

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/0e9ac047546796cfdbe1423d1f4d91c8f37d2fbb11614a7900bb7686aaa5401f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](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/openzipkin/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

48

—

FairBetter than 95% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity54

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 61.7% 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 ~156 days

Recently: every ~178 days

Total

14

Last Release

927d ago

Major Versions

0.2.0 → 1.0.02021-01-19

1.0.0 → 2.0.02021-11-18

PHP version history (3 changes)0.1.4PHP ~5.6 || ~7.0

0.2.0PHP ~7.1

2.0.0PHP &gt;=7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![jcchavezs](https://avatars.githubusercontent.com/u/3075074?v=4)](https://github.com/jcchavezs "jcchavezs (74 commits)")[![eligijusvitkauskas-home24](https://avatars.githubusercontent.com/u/36626058?v=4)](https://github.com/eligijusvitkauskas-home24 "eligijusvitkauskas-home24 (11 commits)")[![limingxinleo](https://avatars.githubusercontent.com/u/16648551?v=4)](https://github.com/limingxinleo "limingxinleo (9 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)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (4 commits)")[![ellisv](https://avatars.githubusercontent.com/u/3896844?v=4)](https://github.com/ellisv "ellisv (4 commits)")[![baoziyo](https://avatars.githubusercontent.com/u/35062657?v=4)](https://github.com/baoziyo "baoziyo (1 commits)")[![lpf32](https://avatars.githubusercontent.com/u/6958020?v=4)](https://github.com/lpf32 "lpf32 (1 commits)")[![Reasno](https://avatars.githubusercontent.com/u/3881629?v=4)](https://github.com/Reasno "Reasno (1 commits)")[![huangdijia](https://avatars.githubusercontent.com/u/8337659?v=4)](https://github.com/huangdijia "huangdijia (1 commits)")[![johanneskonst](https://avatars.githubusercontent.com/u/1047641?v=4)](https://github.com/johanneskonst "johanneskonst (1 commits)")

---

Tags

distributed-tracinghacktoberfestobservabilityopentracingphptracingzipkin

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[jonahgeorge/jaeger-client-php

Jaeger Bindings for PHP OpenTracing API

1484.4M18](/packages/jonahgeorge-jaeger-client-php)[jukylin/jaeger-php

php client for jaeger

2261.6M6](/packages/jukylin-jaeger-php)[vinelab/tracing-laravel

Distributed tracing for Laravel made easy

80118.7k1](/packages/vinelab-tracing-laravel)[lvht/jaeger

php client for jaeger

1240.5k](/packages/lvht-jaeger)

PHPackages © 2026

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