Skip to content
A PHP utility that allows to generate Lorem Ipsum HTML 5
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src
.gitignore
LICENSE
README.md
composer.json

README.md

IpsumHtml

IpsumHtml is a PHP utility that allows to generate Lorem Ipsum HTML 5.

The HTML5 reference used to build this lib is https://developer.mozilla.org/en-US/docs/Web/HTML/Element.
No support for any older version of HTML is planned.

Installation

Simply install the library using composer:

composer require bgaze/ipsum-html

Basic usage

To quickly generate Lorem Ipsum HTML, import the IpsumHtml class into your script, then use it statics methods to generate what you need.

use Bgaze\IpsumHtml\IpsumHtml;

// Generate 50 random html blocks.
$array = IpsumHtml::random(50);

// Generate a full webpage containing 100 random html blocks and print it prettyfied.
echo IpsumHtml::webpage(100);

// Generate and display a HTML table with 4 colums and 10 rows, then print it minified.
echo IpsumHtml::table(4, 10)->minify();

Documentation

Note about code completion
IpsumHtml does an heavy usage of PHP __callStatic method, so using phpDocumentor is necessary to provide code completion. Sadly, the phpDocumentor @method tag isn't well handled by many editors when using the static modifier.

A workaround, used in this lib, is to declared static methods as non-static into phpDocumentor blocks, then to configure the IDE to allow non-static methods after ::.
In Netbeans IDE, you can do that by checking Also Non-Static Methods after :: into Tools > Options > Code Completion > PHP.

IpsumHtml ships three main classes which all methods are statics:

  • Bgaze\IpsumHtml\IpsumHtml: creates HTML nodes randomly populated with Lorem Ipsum text.
  • Bgaze\IpsumHtml\Html: creates HTML nodes. They can be manipulated fluently, minified and prettyfied.
  • Bgaze\IpsumHtml\Ipsum: generates random Ipsum Ipsum text.

There are three types of HTML nodes, handled by a dedicated class:

  • Bgaze\IpsumHtml\Nodes\PlainText: used to handle plain text sections of HTML structures.
  • Bgaze\IpsumHtml\Nodes\Comment: used to handle the special HTML comment tag.
  • Bgaze\IpsumHtml\Nodes\Node: used to handle any other HTML tag.

You can find documentation into following sections:

You can’t perform that action at this time.