setono / html-element
PHP library to generate HTML elements
Installs: 12 083
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
Requires (Dev)
- infection/infection: ^0.27
- phpunit/phpunit: ^9.6
- psalm/plugin-phpunit: ^0.18
- setono/code-quality-pack: ^2.7
This package is auto-updated.
Last update: 2024-11-29 10:12:43 UTC
README
Installation
composer require setono/html-element
Usage
use Setono\HtmlElement\HtmlElement; echo (new HtmlElement('p', 'Lorem ipsum'))->render(); // output: <p>Lorem ipsum</p> echo HtmlElement::p('Lorem ipsum')->render(); // output: <p>Lorem ipsum</p> $outer = HtmlElement::div()->withClass('container'); $inner = HtmlElement::div('Layout'); echo $outer->append($inner)->render(); // output: <div class="container"><div>Layout</div></div>