PHP code example of trismegiste / rpg-name-generator
1. Go to this page and download the library: Download trismegiste/rpg-name-generator 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/ */
trismegiste / rpg-name-generator example snippets
$repo = new FileRepository();
print_r($repo->getSurnameListFor('japanese'));
print_r($repo->getGivenNameListFor('female', 'japanese'));
$repo = new RandomizerDecorator(new FileRepository());
print_r($repo->getSurnameListFor('random')); // gets the list of surnames from a random language
echo $repo->getRandomGivenNameFor('female', 'chinese'); // picks one random chinese female given name
echo $repo->getRandomSurnameFor('french'); // picks one random french surname
echo $repo->getRandomSurnameFor('random'); // picks one random surname from a random language (full random)