hannesvdvreken/guzzle-profiler

一个Guzzle中间件,用于分析客户端发出的请求。

2.1.0 2021-09-23 17:50 UTC

This package is auto-updated.

Last update: 2024-08-30 12:19:39 UTC


README

⚠️ 此项目正在寻求接手。如果您有兴趣积极维护3个密切相关包,请与我们联系。

Build Status Latest Stable Version Code Quality Code Coverage Total Downloads License

Guzzle中间件,用于记录HTTP请求到时间线以进行调试。

适配器

有几个适配器可供选择

用法

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

完成!现在所有请求都将记录到您包装的任何分析器中。

贡献

请随意提交拉取请求。请尽量遵守PSR-2标准。通过运行vendor/bin/php-cs-fixer fix快速修复代码格式。请提供有关要添加/更改/删除/修复内容的良好描述。

测试

在推送代码之前,运行单元测试套件。

vendor/bin/phpunit

许可

MIT