ui-awesome/html-contracts

Shared interfaces for the UI Awesome HTML ecosystem: rendering, attribute management, element typing, and form controls.

Package info

github.com/ui-awesome/html-contracts

pkg:composer/ui-awesome/html-contracts

Statistics

Installs: 6โ€‰067

Dependents: 4

Suggesters: 0

Stars: 2

Open Issues: 5

0.1.0 2026-04-28 16:04 UTC

Requires

  • php: ^8.3

Suggests

None

Provides

None

Conflicts

None

Replaces

None


README

๐Ÿ‘ UI Awesome

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.

Package information

๐Ÿ‘ PHP
๐Ÿ‘ Latest Stable Version
๐Ÿ‘ Total Downloads

Quality code

๐Ÿ‘ PHPStan
๐Ÿ‘ PHPStan Level Max
๐Ÿ‘ Super-Linter
๐Ÿ‘ StyleCI

Our social networks

๐Ÿ‘ Follow on X

License

๐Ÿ‘ License