PHP code example of krafthaus / name-generator

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

    

krafthaus / name-generator example snippets


$words = KraftHaus\NameGenerator\Facades\Generator::generate();
// output: word1 word2

// Or define the amount of words you'd like to output:
$words = KraftHaus\NameGenerator\Facades\Generator::generate(5);
// output: word1 word2 word3 word4 word5

// With the glue parameter:
$words = KraftHaus\NameGenerator\Facades\Generator::generate(3, '-');
// output: word1-word2-word3

$words = KraftHaus\NameGenerator\Facades\Generator::raw();
// output: ['word1', 'word2'];

// Or define the amount of words you'd like to output:
$words = KraftHaus\NameGenerator\Facades\Generator::raw(4);
// output: ['word1', 'word2', 'word3', 'word4'];