PHP code example of writecrow / lorem_gutenberg

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

    

writecrow / lorem_gutenberg example snippets


$text = LoremGutenberg::generate();
echo $text;
// Will return an excerpt of random length (1-10 sentences) from a random author.

$text = LoremGutenberg::generate(array('author' => 'austen'));
echo $text;
// Will return an excerpt of random length (1-10 sentences) from Jane Austen.

$text = LoremGutenberg::generate(array('author' => 'hardy', 'sentences' => 3));
echo $text;
// Will return an excerpt of 3 sentences from Thomas Hardy.

public static $authors = [
  'austen' => 'Jane Austen',
  'hardy' => 'Thomas Hardy',
  'lawrence' => 'D.H. Lawrence',
  'wharton' => 'Edith Wharton',
];