This is a Lorem ipsum generator written in PHP. It is based on the work of Mathew Tinsley and has been refactored so it can be used as a composer module and to match the PSR codestyle. The original code is at the very first commit.
Text generation is based on a fixed dictionary, and randomized using a Gaussian distribution of the word length. Supported output formats are HTML paragraphs (<p/>
), preformatted and unformated plain text. Words per paragraph and number of paragraphs can be configured.
Once again, all credits for the implementation go to Mathew Tinsley.
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/classmarkets/LipsumGenerator"
}
],
"require": {
"classmarkets/lipsum-generator": "*"
}
}
<?php
use Classmarkets\LipsumGenerator;
$wordPerParagraph = 100;
$numberOfParagaphs = 1;
$generator = new LipsumGenerator($wordsPerParagraph);
$htmlLipsum = $generator->getContent($numberOfParagraphs, LipsumGenerator::FORMAT_HTML);
$preFormattedLipsum = $generator->getContent($numberOfParagraphs, LipsumGenerator::FORMAT_TEXT);
$plainLipsum = $generator->getContent($numberOfParagraphs, LipsumGenerator::FORMAT_PLAIN);