lamoni / markupbuilder
A PHP class used for building a single-level DOM object using method chaining and dynamic methods
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
pkg:composer/lamoni/markupbuilder
Requires
- php: >= 5.4.16
This package is not auto-updated.
Last update: 2025-09-27 22:22:51 UTC
README
This class is used for building a single-level DOM object using method chaining and dynamic methods.
Dependencies
- PHP >= 5.4
Considerations
- Implement "Contained" tag creation?
- Remove $elementName, $attributeName, and $attributes properties and instead just pass that data through method arguments?
Examples
The following code:
$div = new \Lamoni\MarkupBuilder\MarkupBuilder(); echo $div->divOpen('myIDHere') ->class('myClassHere') ->madeUpAttribute('theValue') ->attribute_with_hyphen('theHyphenValue'); echo "CONTENT!"; echo $div->divClose();
will generate the following HTML:
<div id="myIDHere" class="myClassHere" madeUpAttribute="theValue" attribute-with-hyphen="theHyphenValue"> Content </div>