Posted on Sep 05, 2014 By Philip Whitt

Need to generate random users for test data in your php app? is a wonderful solution and here is the PHP client.

Install via composer:

    "require": {
        "randomuser/generator"  : "dev-master"

Using the PHP Generator:


$gen = new \RandomUser\Generator();
$user = $gen->getUser();

You can also get many users using:


$gen = new \RandomUser\Generator();
$user = $gen->getUsers(10);
Which returns an array of 10 User objects.

The User object returned is of similar structure the the api, but flat.
class User {

Getters and setters are available for all properties. 

This package is tested using phpunit. To run the tests:
$ phpunit test

Fork it on github! documentation:

Back to Blog