classmarkets/lipsum-generator

This package is abandoned and no longer maintained. No replacement package was suggested.

Lorem Ipsum generator in pure PHP, offline. Capable of generating html, formated and unformatted plain text.

dev-master 2020-02-26 12:27 UTC

This package is auto-updated.

Last update: 2020-02-26 12:31:40 UTC


README

Build Status

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.

Usage:

{
    "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);