setono/html-element

PHP library to generate HTML elements

v1.0.0 2024-02-29 08:39 UTC

This package is auto-updated.

Last update: 2024-10-29 09:58:34 UTC


README

Latest Version Software License Build Status Code Coverage Mutation testing

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>