2017 © Pedro Peláez
 

library guzzle-stopwatch-middleware

Stopwatch Middleware for Guzzle.

image

bmancone/guzzle-stopwatch-middleware

Stopwatch Middleware for Guzzle.

  • Friday, September 1, 2017
  • by bmancone
  • Repository
  • 1 Watchers
  • 2 Stars
  • 32,019 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 27 % Grown

The README.md

Guzzle middleware to time requests

Author Latest Version Build Status, (*1)

Installation

composer require bmancone/guzzle-stopwatch-middleware

Usage

Requires an instance of Symfony\Component\Stopwatch\Stopwatch., (*2)

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Request;

use Symfony\Component\Stopwatch\Stopwatch;

Use Leadz\GuzzleHttp\Stopwatch\StopwatchMiddleware;

// Create the default HandlerStack
$stack = HandlerStack::create();

// Create the middleware
$middleware = new StopwatchMiddleware(new Stopwatch());

// Push the Middleware to the stack
$stack->push($middleware);

// Create the client
$client = new Client([
    'handler' => $stack
]);

// Send the request
$request = new Request('GET', 'https://en.wikipedia.org/wiki/Main_Page');
$response = $client->send($request);

// Get the duration of the request
printf('Request to [%s] took [%dms]', (string)$request->getUri(), $response->getHeaderLine('X-Duration'));

Symfony Profiler

If you are using Symfony, simply inject debug.stopwatch (or use autowiring), this will add events to the profiler timeline., (*3)

The Versions

01/09 2017

dev-master

9999999-dev

Stopwatch Middleware for Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony guzzle stopwatch timeline

01/09 2017

v1.0.0

1.0.0.0

Stopwatch Middleware for Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony guzzle stopwatch timeline

16/06 2017

v0.0.2

0.0.2.0

Stopwatch Middleware for Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony guzzle stopwatch timeline

15/06 2015

v0.0.1

0.0.1.0

Stopwatch Middleware for Guzzle.

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony guzzle stopwatch timeline