Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2025-04-06 (4 days ago)  | | Not yet rated by the users | | Total: Not yet counted | | Not yet ranked |
|
Description | | Author |
This package can compose and generate HTML pages from objects.
It provides classes that have the properties of different HTML tags.
Applications can compose the HTML page structure, creating HTML tag objects and associating parent page objects with child page objects.
The class can generate HTML for the whole document after the page is composed.
Currently, the package supports the tags:
- a
- abbr
- address
- area
- article
- aside
- audio
- base
- bdi
- bdo
- blockquote
- body
- br
- button
- canvas
- caption
- cite
- code
- col
- colgroup
- data
- datalist
- dd
- del
- details
- dfn
- dialog
- div
- dl
- dt
- em
- embed
- fieldset
- figcaption
- figure
- footer
- form
- h
- head
- header
- hr
Plain text file Html.php Class Class source 31,042 Less than 1 hour ago 0 Edit
- i
- iframe
- img
- input
- ins
- kbd
- label
- legend
- li
- link
- main
- map
- mark
- meta
- meter
- nav
- noscript
- object
- ol
- optgroup
- option
- output
- p
- param
- picture | |
 |
|
Innovation award
 Nominee: 3x
Winner: 1x |
|
Instructions
Details
HTML Element Generator
This PHP class provides a convenient way to generate HTML elements with attributes and child elements. It supports creating a variety of HTML tags and setting attributes using a fluent interface.
Usage
-
Include the `HtmlElement` class in your PHP code.
-
Create an instance of the `HtmlElement` class to generate HTML elements.
-
Use the various methods provided by the class to set attributes, add child elements, and modify properties.
-
Output the generated HTML using the `output()` method.
Creating and Modifying HTML Elements
// Create an HTML element
$html = new HtmlElement('div');
$html->setId('myDiv')->setClass('some-class');
// Add child elements and modify them
$html->add_child('MainTitle','h1')->text('Hello, World!')->setClass('title');
// Modify the child element using a fluent interface
$html->MainTitle->setStyle('color: blue;');
// Output the HTML
echo $html->output();
TO DO:
-
[ ] Finish the implementation of all html tags.
-
[ ] Add support for HTMX.
-
[ ] Add support for Hyperscript.
- [ ] Add suport for Css frameworks like bootstrap or tailwind.
|
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.