Skip to content

marotpam/zipkin-instrumentation-stripe-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zipkin instrumentation for Stripe's PHP library

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);
}

About

Stripe PHP client with Zipkin instrumentation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages