PHP code example of kosv / randomuser-client

1. Go to this page and download the library: Download kosv/randomuser-client 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/ */

    

kosv / randomuser-client example snippets




use Kosv\RandomUser\Client\{Client, QueryBuilder};
use Kosv\RandomUser\Transport\CurlTransport;

$client = new Client(new CurlTransport());

$query = new QueryBuilder();
$query->setIncludeFields(['name', 'email'])->setPage(3)->setMaxResult(100);

$response = $client->request($query);
$users = $response->getUsers();
$info = $response->getInfo();