waughj / html-tag
Simple class for generating HTML tag.
v0.1.0
2019-09-10 17:26 UTC
Requires
- php: >=7.2
- waughj/html-attribute-list: ^1.2
Requires (Dev)
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2025-03-11 05:50:04 UTC
README
Simple class for generating HTML tag.
Use
This class's constructor takes 3 arguments, 2 of which are optional:
- The tag name (string)
- A list of attributes (associative array)
- Content (anything that can be converted into a string, including other HTMLTag instances)
Example
use WaughJ\HTMLTag\HTMLTag;
echo new HTMLTag
(
'div',
[ 'class' => 'main' ],
new HTMLTag
(
'img',
[ 'src' => 'image.gif' ]
)
);
will generate:
<div class="main">
<img src="image.gif" />
</div>
Changelog
0.1.0
- Initial Release