mops1k/lazy-http-client-bundle

This package is abandoned and no longer maintained. The author suggests using the mops1k/api-client-bundle package instead.

Bundle for making async `lazy` http requests

1.5 2019-11-25 10:23 UTC

This package is auto-updated.

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


README

This bundle provides lazy http client for symfony 4.1 and above. Lazy means that before you are not using any response methods, request doesn't execute.

Instructions

Usage

Simple usage example

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();