mops1k/lazy-http-client-bundle

此包已被放弃,不再维护。作者建议使用 mops1k/api-client-bundle 包代替。

异步 `lazy` http 请求的 Bundle

安装: 25

依赖: 0

推荐者: 0

安全性: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

1.5 2019-11-25 10:23 UTC

This package is auto-updated.

Last update: 2022-11-09 06:55:48 UTC


README

此 Bundle 为 symfony 4.1 及以上版本提供懒加载 http 客户端。懒加载的意思是在您不使用任何响应方法之前,请求不会执行。

说明

用法

简单用法示例

use LazyHttpClientBundle\Client\Manager;
use App\ReqresFakeApi\Client;
use App\ReqresFakeApi\Query\ListUsersQuery;
use App\ReqresFakeApi\Query\SingleUserQuery;

$client = $this->get(Manager::class)->get(Client::class);
$client->use(ListUsersQuery::class);
$listResult = $client->execute();

$client->getRequest()->getParameters()->set('page', 2);
$listResult2 = $client->execute();

echo $listResult->getContent();
echo $listResult2->getContent();
echo $listResult2->getStatusCode();