dance-engineer/guzzle-tracy

This package is abandoned and no longer maintained. No replacement package was suggested.

Debug panel for Guzzle connections

1.0.0 2020-02-17 22:26 UTC

This package is auto-updated.

Last update: 2023-05-18 05:36:29 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]);
    }
}