Last active
October 19, 2016 04:46
-
-
Save YavorK/f91780cd29a290fd7b9846f97ab8cf17 to your computer and use it in GitHub Desktop.
Generate names with faker (fzaninotto/faker)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this script uses https://github.com/fzaninotto/Faker | |
// to generate male/female names: | |
require 'vendor/autoload.php'; | |
// use the factory to create a Faker\Generator instance | |
$faker = Faker\Factory::create(); | |
// generate data by accessing properties | |
$maleNames = []; | |
for ($i = 0; $i < 100; $i++) { | |
$maleNames[] = $faker->name('male'); | |
} | |
echo '<?php'.PHP_EOL; | |
echo PHP_EOL; | |
echo '$maleNames = '; | |
var_export($maleNames); | |
echo ';'; | |
$femaleNames = []; | |
for ($i = 0; $i < 100; $i++) { | |
$femaleNames[] = $faker->name('female'); | |
} | |
echo PHP_EOL; | |
echo PHP_EOL; | |
echo '$femaleNames = '; | |
var_export($femaleNames); | |
echo ';'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example result at https://gist.github.com/YavorK/17087497fb39be7238a24ab0f5523e2d