PHP code example of voodooism / randomuser-api-client

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

    

voodooism / randomuser-api-client example snippets


  $serializer = SerializerBuilder::create()->build();

  $options = new ClientOptions('https://randomuser.me');

  $client = new Client($serializer, new HttpClient(), $options);
  
  //One user
  $user = $this->client->getRandomUser();
  
  //Array of users
  $users = $this->client->getRandomUsers(10);