ui-awesome/html-contracts
Shared interfaces for the UI Awesome HTML ecosystem: rendering, attribute management, element typing, and form controls.
Maintainers
Requires
- php: ^8.3
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
BSD-3-Clause 7d9f02e2f95007ea63c36394be007627c852a63a
phphtmlattributesinterfacesrenderableui-awesomehtml-contractsform-controlblock-elementinline-elementvoid-element
This package is auto-updated.
Last update: 2026-06-22 13:34:26 UTC
README
Html helper
Contracts (interfaces) for the UI Awesome HTML ecosystem for PHP
Provides shared interfaces for rendering, attribute management, and form control typing across HTML packages.
Installation
composer require ui-awesome/html-contracts:^0.1
Interfaces
RenderableInterface
Core contract for any object that can be rendered as an HTML string. Extends Stringable.
<?php declare(strict_types=1); use UIAwesome\Html\Contracts\RenderableInterface; final class MyTag implements RenderableInterface { public function __toString(): string { return $this->render(); } public function render(): string { return '<div>Hello</div>'; } }
AttributesInterface
Contract for objects that manage HTML attributes with an immutable API.
Methods: attributes(), class(), getAttribute(), getAttributes(), removeAttribute(), setAttribute().
FormControlInterface
Composed interface extending both RenderableInterface and AttributesInterface. Use this to type form control
elements (inputs, selects, textareas, etc.) that need both rendering and attribute management.
<?php declare(strict_types=1); use UIAwesome\Html\Contracts\Form\FormControlInterface; function renderField(FormControlInterface $control): string { return $control->class('form-control')->render(); }
Documentation
For detailed configuration options and advanced usage.
- ๐งช Testing Guide
Package information
๐ PHP
๐ Latest Stable Version
๐ Total Downloads
Quality code
๐ PHPStan
๐ PHPStan Level Max
๐ Super-Linter
๐ StyleCI
