lamoni / markupbuilder
A PHP class used for building a single-level DOM object using method chaining and dynamic methods
v1.0.0
2015-03-25 01:03 UTC
Requires
- php: >= 5.4.16
This package is not auto-updated.
Last update: 2024-12-21 18:15:35 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>