【发布时间】:2015-10-30 10:11:59
【问题描述】:
我正在尝试使用 Guzzle (v 6) 分析从 PHP 客户端向 API 服务器发出的请求。
在 Guzzle 5.3 中有 complete 和 before 事件处理。
class GuzzleProfiler implements SubscriberInterface
{
public function getEvents()
{
return [
'before' => ['onBefore'],
'complete' => ['onComplete']
];
}
public function onBefore(BeforeEvent $event, $name)
{
start_profiling();
}
public function onComplete(CompleteEvent $event, $name)
{
end_profiling();
}
}
但是如何在 v6 中做到这一点?
【问题讨论】:
-
您可以安装github.com/e-moe/guzzle6-bundle,它在分析器中集成了 Guzzle 6 调用。