PHP code example of joshmoody / mock-data

1. Go to this page and download the library: Download joshmoody/mock-data 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/ */

    

joshmoody / mock-data example snippets


$phone = $generator->getPhone([$state_code = false, $zip = false, $
 php
$generator = new joshmoody\Mock\Generator();

$person = $generator->getPerson('AR');
print_r($person);
 php
$name = $generator->getFullName();

/*
joshmoody\Mock\Entities\FullName Object
(
    [first] => Laurie
    [middle] => Joyce
    [last] => Wilson
    [gender] => F
)
*/
 php
$first = $generator->getFirstName('M'); // M=Male, F=Female, null = random.
/*
string(8) "Clarence"
*/

$middle = $generator->getMiddleName('M'); // M=Male, F=Female, null = random.
/*
string(4) "Dale"
*/

$last = $generator->getLastName();
/*
string(6) "Rogers"
*/
 php
$internet = $generator->getInternet([$person_name = null, $company = null]);
/*
joshmoody\Mock\Entities\Internet Object
(
    [domain] => martinez.us
    [username] => swilliams
    [email] => [email protected]
    [url] => https://martinez.us
    [ip] => 157.116.10.90
)
*/

$domain = $generator->getDomain($domain = null);
/*
string(8) "dean.com"
*/

$username = $generator->getUsername([$person_name = null]);
/*
string(14) "pedro.thompson"
*/

$email = $generator->getEmail([$person_name = null, $domain = null]);
/*
string(20) "[email protected]"
*/

$url = $generator->getUrl();
/*
string(19) "http://hernandez.us"
*/

$ip = $generator->getIp();
/*
string(13) "101.114.68.26"
*/
 php
$color = $generator->fromArray(['Red' , 'White', 'Blue']);
/*
string(3) "Red"
*/
 php
$generator = new joshmoody\Mock\Generator();
 bash
$ php bin/load.php