PHP code example of hannesvdvreken / guzzle-debugbar
1. Go to this page and download the library: Download hannesvdvreken/guzzle-debugbar 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-debugbar example snippets
$debugBar = new StandardDebugBar();
// or when using Laravel:
$debugBar = app('debugbar');
// Get data collector.
$timeline = $debugBar->getCollector('time');
// Wrap the timeline.
$profiler = new \GuzzleHttp\Profiling\Debugbar\Profiler($timeline);
// Add the middleware to the stack
$stack = \GuzzleHttp\HandlerStack::create();
$stack->unshift(new \GuzzleHttp\Profiling\Middleware($profiler));
// New up the client with this handler stack.
$client = new \GuzzleHttp\Client(['handler' => $stack]);
$debugBar = new StandardDebugBar();
// or when using Laravel:
$debugBar = app('debugbar');
// PSR-3 logger:
$logger = $debugBar->getCollector('messages');
// Create a new Log middleware.
$stack->push(\GuzzleHttp\Middleware::log($logger, new \GuzzleHttp\MessageFormatter()));
// New up the client with this handler stack.
$client = new \GuzzleHttp\Client(['handler' => $stack]);