marotpam / zipkin-instrumentation-stripe-php
Zipkin instrumentation for Stripe HTTP Client in PHP
v0.1
2018-11-20 08:34 UTC
Requires
- php: ~7.1
- openzipkin/zipkin: ~1.3.1
- stripe/stripe-php: ~6.10
Requires (Dev)
- mockery/mockery: ~1.1
- phpunit/phpunit: ~5.6.3
- squizlabs/php_codesniffer: 3.*
This package is not auto-updated.
Last update: 2025-03-20 15:38:39 UTC
README
Stripe PHP client with Zipkin instrumentation
Installation
composer require marotpam/zipkin-instrumentation-stripe-php
Usage
You need to override the default HttpClient that stripe-php uses, with one that includes the Zipkin Tracer shared of your application. For further details on how to use Zipkin in your PHP applications please refer to Zipkin's official PHP library
use Stripe\ApiRequestor; use Stripe\HttpClient\CurlClient; use Stripe\Stripe; use Zipkin\Tracer; use ZipkinStripe\HttpClient; /** * @param string $stripeSecretKey Stripe API key * @param Tracer $tracer Zipkin tracer used across your application */ public function initialiseStripeClient(string $stripeSecretKey, Tracer $tracer) { Stripe::setApiKey($stripeSecretKey); $instrumentedStripeClient = new HttpClient(CurlClient::instance(), $tracer); ApiRequestor::setHttpClient($instrumentedStripeClient); }