emag-tech-labs / guzzle-middleware
Guzzle 中间件
v1.0.0
2023-02-17 12:29 UTC
Requires
- php: ^7.2 | ^8.1
- guzzlehttp/guzzle: ^6.0|^7.0
- liuggio/statsd-php-client: ^1.0
- slickdeals/statsd: ^2.0|^3.0
Requires (Dev)
- phpstan/phpstan: ^0.12.25
- phpunit/phpunit: ^6.5|^7.0|^8.0
README
这是一个 Guzzle 中间件,它允许您分析 http 调用,并将信息发送到 statsd 守护进程。
要求
依赖
安装
此库通过 composer
安装。
composer require "emag-tech-labs/guzzle-middleware"
使用方法
该软件包可以与 2 个不同的 statsd 库一起工作,illugio 或 dominikl。根据您的选择,您将需要使用正确的适配器(DominikAdapter 或 IlugioAdapter)以实例化 statsd 客户端。
示例
$statsdClient = new DominikAdapter($dominikStatsdClient); $handlerStack = new HandlerStack(); $handlerStack->push(new TimingProfiler($statsdClient)); $handlerStack->push(new HttpCodeProfiler($statsdClient)); $client = new Client(['handler' => $handlerStack]);