dance-engineer/guzzle-tracy

Debug panel for Guzzle connections

1.0.0 2020-02-17 22:26 UTC

This package is auto-updated.

Last update: 2020-11-17 23:56:30 UTC


README

A Tracy debug bar for Guzzle Connection

Example

<?php

use DanceEngineer\GuzzleTracy\Panel;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\CurlHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Profiling\Middleware;
use Tracy\Debugger;

final class FitBitClientFactory
{

    public static function create(): Client
    {
        $panel = new Panel();
        $stack = new HandlerStack();
        $stack->setHandler(new CurlHandler());
        
        $stack->push(new Middleware($panel));
        $debugBar = Debugger::getBar();
        $debugBar->addPanel($panel, 'fitbit');
        
        return new Client(['handler' => $stack]);
    }
}