php-extended/php-http-client-dnt

一个符合psr-18规范的中间件客户端,用于处理不跟踪头

7.0.6 2024-07-31 13:48 UTC

README

一个符合psr-18规范的中间件客户端,用于处理不跟踪头。

coverage build status

安装

该库的安装通过composer完成,所有类的自动加载均通过其自动加载器实现。

  • 官方网站下载 composer.phar
  • 然后运行以下命令将此库作为依赖项安装
  • php composer.phar php-extended/php-http-client-dnt ^7

基本用法

该库旨在为http请求和响应创建一个中间人,并在请求通过时记录事件。它可以按以下方式使用


/* @var $client Psr\Http\Client\ClientInterface */    // psr-7
/* @var $request Psr\Http\Message\RequestInterface */ // psr-7

$client = new DoNotTrackClient($client);
$response = $client->sendRequest($request);

/* @var $response Psr\Http\Message\ResponseInterface */

此库处理请求中DNT头的添加。

许可协议

MIT (见许可文件)。