Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2020-08-12 (1 month ago)  | | Not yet rated by the users | | Total: 93 This week: 3 | | All time: 9,473 This week: 119 |
|
Description | | Author |
This package can compose and generate HTML programatically.
It provides a document class that can compose HTML documents by adding contained element objects. Then it returns a string with the generated HTML.
The package also provides a HTML element class that be used to define many types of HTML page elements like paragraphs, headings, text formatting styles, links, forms, inputs, images, tables, etc.. | |
 |
|
Innovation award
 Nominee: 4x
Winner: 1x |
|
Details
gen-html
PHP Library for generating HTML document



Installation
You can install this library with Composer:
-
`composer require abgeo/gen-html`
Usage
Include composer autoloader in your main file (Ex.: index.php)
-
`require_once __DIR__ . '/../vendor/autoload.php';`
Classes
The library has two classes:
-
`\ABGEO\HTMLGenerator\Document` - For generating Full HTML5 Document;
-
`\ABGEO\HTMLGenerator\Element` - For generating HTML element;
Class Document
Import ABGEO\HTMLGenerator\Document
class.
Public Methods
-
`setLanguage()` - Set document content language (Document::LANG_* constants);
-
`setCharset()` - Set charset for document (Document::CHARSET_* constants);
-
`setTitle()` - Set Document title;
-
`setDescription()` - Set Document description;
-
`setKeywords()` - Set Document keywords;
-
`addStyle()` - Add CSS file path;
-
`setBody()` - Set Document body content;
-
`addScript()` - Set JS file path;
-
`getDocument()` - Get generated HTML code;
Note: See usage in example.php
Class Element
Import ABGEO\HTMLGenerator\Element
class.
Public Methods
-
`add2Content()` - Add given string to HTML content;
-
`getHtml()` - Get HTML Content;
-
`concatenateElements()` - Concatenate given elements;
-
`createLink()` - Generate a tag;
-
`createArticle()` - Generate article tag;
-
`createBlockquote()` - Generate blockquote tag;
-
`createBreak()` - Generate br tag;
-
`createCode()` - Generate code tag;
-
`createDiv()` - Generate div tag;
-
`createEm()` - Generate em tag;
-
`createForm()` - Generate form tag;
-
`createFooter()` - Generate footer tag;
-
`createHeading()` - Generate h1-h6 tags;
-
`createHeader()` - Generate header tag;
-
`createLine()` - Generate hr tag;
-
`createI()` - Generate i tag;
-
`createImg()` - Generate img tag;
-
`createInput()` - Generate input tag;
-
`createLabel()` - Generate label tag;
-
`createList()` - Generate ol or ul tags;
-
`createNav()` - Generate nav tag;
-
`createParagraph()` - Generate p tag;
-
`createPre()` - Generate pre tag;
-
`createProgress()` - Generate progress tag;
-
`createSection()` - Generate section tag;
-
`createSelect()` - Generate select tag;
-
`createSpan()` - Generate span tag;
-
`createStrong()` - Generate strong tag;
-
`createSub()` - Generate sub tag;
-
`createSup()` - Generate sup tag;
-
`createTable()` - Generate table tag;
-
`createTextarea()` - Generate textarea tag;
-
`clear()` - Clear HTML content;
Note: See usage in example.php
Examples
See full example in example.php and sample Bootstrap 4 page in
bootstrap.php.
Authors
-
Temuri Takalandze - Initial work - ABGEO
License
This project is licensed under the MIT License - see the LICENSE file for details
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.