PHP code example of hannesvdvreken / guzzle-profiler
1. Go to this page and download the library: Download hannesvdvreken/guzzle-profiler 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/ */
hannesvdvreken / guzzle-profiler example snippets
// First you need a HandlerStack
$stack = GuzzleHttp\HandlerStack::create();
// Create a middleware by wrapping a profiler (eg: DebugBar's profiler):
/** @var DebugBar\DebugBar $debugBar */
$timeline = $debugBar->getCollector('time');
$profiler = new GuzzleHttp\Profiling\DebugBar\Profiler($timeline);
$middleware = new GuzzleHttp\Profiling\Middleware($profiler);
// Add the Middleware to the stack of middlewares.
$stack->unshift($middleware);
// Then you need to add it to the Guzzle HandlerStack
$stack = GuzzleHttp\HandlerStack::create();
$stack->unshift($middleware);
// Create a Guzzle Client with the new HandlerStack:
$client = new GuzzleHttp\Client(['handler' => $stack]);