library markupbuilder
A PHP class used for building a single-level DOM object using method chaining and dynamic methods
lamoni/markupbuilder
A PHP class used for building a single-level DOM object using method chaining and dynamic methods
- Wednesday, March 25, 2015
- by lamoni
- Repository
- 1 Watchers
- 0 Stars
- 21 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 1 Open issues
- 2 Versions
- 0 % Grown
MarkupBuilder
This class is used for building a single-level DOM object using method chaining and dynamic methods., (*1)
Dependencies
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:, (*2)
<div id="myIDHere" class="myClassHere" madeUpAttribute="theValue" attribute-with-hyphen="theHyphenValue">
Content
</div>