ui-awesome / html-core
UI Awesome HTML Core Code Generator for PHP.
Requires
- php: ^8.1
- php-forge/awesome-widget: ^0.1
- ui-awesome/html-attribute: ^0.2
- ui-awesome/html-concern: ^0.2
- ui-awesome/html-helper: ^0.2
- ui-awesome/html-interop: ^0.1
Requires (Dev)
- maglnet/composer-require-checker: ^4.7
- php-forge/support: ^0.1
- phpunit/phpunit: ^10.5
- roave/infection-static-analysis-plugin: ^1.34
- symplify/easy-coding-standard: ^12.1
- vimeo/psalm: ^5.20
This package is auto-updated.
Last update: 2024-11-30 21:26:37 UTC
README
UI Awesome HTML Core Code Generator for PHP.
This package provides a set of HTML
helper and widgets for generating HTML
elements in a programmatic way with
PHP
.
Installation
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.
Usage
Create a new HTML
element
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']) ?>
Create a new HTML
block element
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') ?>
Generic widget
Testing
Check the documentation testing to learn about testing.
Support versions
License
The MIT License (MIT). Please see License File for more information.