PHP code example of andreasindal / rpgfaker

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

    

andreasindal / rpgfaker example snippets




use RPGFaker\RPGFaker;

$faker = new RPGFaker();
echo $faker->name;
echo $faker->town;

// Rildess Fazhria
// Northfall

$faker = new RPGFaker([
    'race'          => null,
    'length'        => 2,
    'count'         => 2,
    'special'       => 'random',
    'duplicates'    => [true, 5],
]);



use RPGFaker\RPGFaker;

$faker = new RPGFaker([
    'length' => [1, 2, 3],
    'count'  => 3
]);
echo $faker->name;

// example output: Varr Iennahr Cynsadorf



use RPGFaker\RPGFaker;

$faker = new RPGFaker([
    'count'  => 1
]);
echo $faker->name;

// example output: Wogien

$faker->setOptions([
    'count'  => 3
]);
echo $faker->name;

// example output: Steinril Annton Saeith



use RPGFaker\RPGFaker;

$faker = new RPGFaker([
    'special' => true
]);
echo $faker->name;

// example output: Dirwog Greenhorn

$faker->setOptions([
    'special' => false
]);
echo $faker->name;

// example output: Annlor Makceh