Contracts (interfaces) for the UI Awesome HTML ecosystem for PHP
Provides shared interfaces for rendering, attribute management, and form control typing across HTML packages.
composer require ui-awesome/html-contracts:^0.1Core 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>';
}
}Contract for objects that manage HTML attributes with an immutable API.
Methods: attributes(), class(), getAttribute(), getAttributes(), removeAttribute(), setAttribute().
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();
}For detailed configuration options and advanced usage.