PHP code example of kield-01 / random-user-php-sdk

1. Go to this page and download the library: Download kield-01/random-user-php-sdk 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/ */

    

kield-01 / random-user-php-sdk example snippets




use KielD01\RandomUser\RandomUser;

try {
    $randomUser = new RandomUser('1.1');

    $results = $randomUser
        ->setNationalityOnly('us', true)
        ->setResultsCount(50)
        ->fetch()
        ->getResults();

    // ToDo : Process with $results
} catch (Exception $e) {
    echo "<pre>{$e->getMessage()}</pre>";
}