| Package Data | |
|---|---|
| Maintainer Username: | jiyis | 
| Maintainer Contact: | wind.remember@gmail.com (Gary F Dong) | 
| Package Create Date: | 2017-08-10 | 
| Package Last Update: | 2018-03-14 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-27 03:01:52 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 5,037 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 0 | 
| Total Watchers: | 1 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
This is an unofficial PHP library for OpenZipkin.
Incomplete, only has one transport with zero integrations. This library contains a very minimal implementation for just sending spans to zipkin.
The recommended way to install PHP-Zipkin is through Composer
composer require drefined/php-zipkin
<?php
$client   = new \GuzzleHttp\Client();
$logger   = new \Drefined\Zipkin\Transport\HTTPLogger($client);
$tracer   = new \Drefined\Zipkin\Tracer($logger, 1.0, true);
$endpoint = new \Drefined\Zipkin\Core\Endpoint('127.0.0.1', 8080, 'test-trace');
$trace    = new \Drefined\Zipkin\Core\Trace($tracer, $endpoint);
$trace->createNewSpan('test-server-trace');
$trace->record(
    [Annotation::generateServerRecv()],
    [BinaryAnnotation::generateString('server.request.uri', '/server')]
);
$trace->record(
    [Annotation::generateServerSend()],
    [BinaryAnnotation::generateString('server.response', 200)]
);
Add middleware and service provider in proper locations.
<?php // laravel-project/app/Http/Kernel.php
namespace App\Http;
use ...
use Drefined\Zipkin\Instrumentation\Laravel\Middleware\EnableZipkinTracing;
class Kernel extends HttpKernel
{
    ...
    protected $middleware = [
        ...
        EnableZipkinTracing::class,
    ];
    ...
}
<?php // laravel-project/config/app.php
use Drefined\Zipkin\Instrumentation\Laravel\Providers\ZipkinTracingServiceProvider;
return [
    ...
    'providers' => [
        ...
        ZipkinTracingServiceProvider::class,
    ],
    ...
];