PHP code example of crainios / ultimate-lorem-generator

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

    

crainios / ultimate-lorem-generator example snippets


use UltimateLoremGenerator\Generator;

$generator = new Generator();

// 120 mots, 4 paragraphes, thème botanique, sans ponctuation, texte brut.
echo $generator->generate(120, 4);

// Les cinq paramètres.
echo $generator->generate(120, 4, 'science-fiction', 'french', 'markdown');

generate(
    int $words,
    int $paragraphs,
    Theme|string $theme = Theme::BOTANIQUE,
    PunctuationStyle|string|bool $punctuation = false,
    OutputFormat|string $format = OutputFormat::TEXT,
): string

$styles = Generator::punctuationStyles();
// ['standard', 'french', 'spanish']

echo $generator->generate(40, 1, 'botanique', 'french', 'json');

echo $generator->generateHtml(80, 3, 'ocean', 'spanish');
bash
php bin/ultimate-lorem --words=120 --paragraphs=4
php bin/ultimate-lorem --words=80 --paragraphs=3 --theme=fantasy --punctuation
php bin/ultimate-lorem --words=80 --paragraphs=3 --theme=fantasy --punctuation=spanish
php bin/ultimate-lorem --words=40 --paragraphs=2 --theme=ocean --format=html
bash
composer test
# ou
php tests/run.php