bentools/guzzle-duration-middleware
最新稳定版本:1.0
Composer 安装命令:
composer require bentools/guzzle-duration-middleware
包简介
A GuzzleHTTP Middleware that adds a X-Request-Duration header to all responses to monitor response times.
README 文档
README
This package is a middleware for GuzzleHttp 6+ that helps you monitor the time between requests and responses.
Usage
require_once __DIR__ . '/vendor/autoload.php'; use BenTools\GuzzleHttp\Middleware\DurationHeaderMiddleware; use GuzzleHttp\Client; $client = new Client(); $middleware = new DurationHeaderMiddleware($headerName = 'X-Request-Duration'); // header name is optional, this is the default value $client->getConfig('handler')->push($middleware); $response = $client->get('http://httpbin.org/delay/1'); var_dump((float) $response->getHeaderLine('X-Request-Duration')); // 1.177
Installation
composer require bentools/guzzle-duration-middleware
Tests
./vendor/bin/phpunit
统计信息
- 总下载量: 57.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-09