phlib/guzzle-middleware

Guzzle 中间件:绝对URL,字符集转换

2.0.0 2022-12-10 08:25 UTC

This package is auto-updated.

Last update: 2024-09-03 08:43:41 UTC


README

Code Checks Codecov Latest Stable Version Total Downloads Licence

Guzzle 中间件

安装

通过 Composer

$ composer require phlib/guzzle-middleware

PHP 使用

<?php
declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use Phlib\Guzzle\AbsoluteUrls;
use Phlib\Guzzle\ConvertCharset;

$handler = \GuzzleHttp\HandlerStack::create();
$handler->push(new ConvertCharset());
$handler->push(new AbsoluteUrls);

$client = new \GuzzleHttp\Client(['handler' => $handler]);
echo (string)$client->get('http://www.example.com')->getBody();

许可证

此软件包是免费软件:您可以按照自由软件基金会发布的GNU通用公共许可证的条款重新分配和/或修改它,无论是许可证的第3版,还是(根据您的选择)任何更高版本。

此程序的分发是希望它是有用的,但没有提供任何保证;甚至没有关于其商业性或适用于特定目的的隐含保证。有关详细信息,请参阅GNU通用公共许可证。

您应该已经收到随此程序一起提供的GNU通用公共许可证副本。如果没有,请参阅https://gnu.ac.cn/licenses/