PHP code example of mops1k / lazy-http-client-bundle

1. Go to this page and download the library: Download mops1k/lazy-http-client-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mops1k / lazy-http-client-bundle example snippets


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