PHP code example of iritesh37 / random-word-generator

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

    

iritesh37 / random-word-generator example snippets




use Iritesh37\RandomWordGenerator\Generator;

echo Generator::generate(); // Outputs 'ancient butterfly', 'celestial flower', etc.




use Iritesh37\RandomWordGenerator\Generator;

echo Generator::generate('-'); // Outputs 'ancient-butterfly', 'celestial-flower', etc.




use Iritesh37\RandomWordGenerator\Generator;

echo Generator::generate('-', 4); // Outputs 'ancient-butterfly-celestial-flower', etc.




use Iritesh37\RandomWordGenerator\Generator;

$adjectives = ['adjective one', 'adjective two'];
$nouns = ['noun one', 'noun two'];

Generator::setWordLists($adjectives, $nouns);



use Iritesh37\RandomWordGenerator\Words\Adjective;

$adjectives = ['adjective one', 'adjective two'];

Adjective::setWordList($adjectives);



use Iritesh37\RandomWordGenerator\Words\Noun;

$nouns = ['noun one', 'noun two'];

Noun::setWordList($nouns);