This package provides a set of HTML
helper and widgets for generating HTML
elements in a programmatic way with
PHP
.
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist ui-awesome/html-core:^0.1
or add
"ui-awesome/html-core": "^0.1"
to the require section of your composer.json
file.
To create a new HTML
element, you can use the HTMLBuilder::class
with the createTag()
method.
Allowed arguments are:
tag
(string) - The tag name.content
(string) - The content of the tag.attributes
(array) - The attributes of the tag.
<?php
declare(strict_types=1);
use UIAwesome\Html\Core\HTMLBuilder;
?>
<?= HTMLBuilder::createTag('div', 'Hello, World!', ['class' => 'container']) ?>
To create a new HTML
block element, you can use the HTMLBuilder::class
with the beginTag()
and endTag()
methods.
Allowed arguments for beginTag()
method are:
tag
(string) - The tag name.attributes
(array) - The attributes of the tag.
Allowed arguments for endTag()
method are:
tag
(string) - The tag name.
<?php
declare(strict_types=1);
use UIAwesome\Html\Core\HTMLBuilder;
<?= HTMLBuilder::beginTag('div', ['class' => 'container']) ?>
Hello, World!
<?= HTMLBuilder::endTag('div') ?>
Check the documentation testing to learn about testing.
The MIT License (MIT). Please see License File for more information.