phore / http-client
快速API访问的HTTP客户端库
v1.0.9
2024-01-30 11:20 UTC
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- phore/core: *
Requires (Dev)
Suggests
- phore/cache: Use request caching
This package is auto-updated.
Last update: 2024-09-23 11:11:10 UTC
README
易于使用且API流畅的HTTP客户端。
示例
phore_http_request("http://localhost/test.php?case=200")->withMethod()
请求缓存
请求缓存需要安装 phore/cache
包
$cache = new Cache(new ObjectStore(new FileSystemObjectStoreDriver("/tmp/cache1")));
$req = phore_http_request("http://localhost/")->withCache($cache)->send();
if ($req->isFromCache() === true)
echo "From Cache: " . $req->getBody();
示例