mops1k / lazy-http-client-bundle
1.5
2019-11-25 10:23 UTC
Requires
- php: ^7.1.3
- ext-json: *
- guzzlehttp/guzzle: ~6.0
- ocramius/proxy-manager: ^2.2
- symfony/framework-bundle: ~4.1|~4.2|~4.3|~4.4|~5.0
- symfony/monolog-bundle: ^3.4
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();