萨克鲁姆 / 萨克鲁姆-HTTP客户端适配器-Guzzle
此包已弃用,不再维护。未建议替代包。
萨克鲁姆 HTTP 客户端适配器 Guzzle
1.0.2
2014-10-24 19:30 UTC
Requires
- php: >=5.3
- guzzlehttp/guzzle: ~5.0
- saxulum/saxulum-http-client-interface: ~1.1
Requires (Dev)
- phpunit/phpunit: ~4.0
Provides
This package is not auto-updated.
Last update: 2020-09-22 19:10:11 UTC
README
功能
- 为 guzzle 提供一个 HTTP 客户端接口适配器
要求
- PHP 5.3+
- Guzzle ~5.0 (PHP 5.4+)
安装
通过 Composer 安装,作为 saxulum/saxulum-http-client-adapter-guzzle。
使用方法
use Saxulum\HttpClient\Guzzle\HttpClient;
use Saxulum\HttpClient\Request;
$httpClient = new HttpClient();
$response = $httpClient->request(new Request(
'1.1',
Request::METHOD_GET,
'http://en.wikipedia.org',
array(
'Connection' => 'close',
)
));
在创建 HTTP 客户端实例时,您可以注入自己的 Guzzle 客户端实例。
use GuzzleHttp\Client;
use Saxulum\HttpClient\Guzzle\HttpClient;
$client = new Client;
$httpClient = new HttpClient($client);