PHP code example of dance-engineer / guzzle-tracy

1. Go to this page and download the library: Download dance-engineer/guzzle-tracy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dance-engineer / guzzle-tracy example snippets




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