PHPackages                             ui-awesome/html-concern - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. ui-awesome/html-concern

ActiveLibrary[Templating &amp; Views](/categories/templating)

ui-awesome/html-concern
=======================

Reusable PHP traits for HTML rendering components: attribute management, content, templates, and prefix/suffix/label collections.

0.6.0(2mo ago)111.7k↓63.3%[6 PRs](https://github.com/ui-awesome/html-mixin/pulls)2BSD-3-ClausePHPPHP ^8.3CI passing

Since Mar 5Pushed 5d ago1 watchersCompare

[ Source](https://github.com/ui-awesome/html-mixin)[ Packagist](https://packagist.org/packages/ui-awesome/html-concern)[ RSS](/packages/ui-awesome-html-concern/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (20)Versions (29)Used By (2)

 [ ![UI Awesome](https://raw.githubusercontent.com/ui-awesome/.github/refs/heads/main/logo/ui_awesome.png) ](https://github.com/ui-awesome/html-mixin)

Html Mixin
==========

[](#html-mixin)

 [ ![PHPUnit](https://camo.githubusercontent.com/d702c61f0b046acbeade0190016d92609c0c652b290f5c5c27918de7839792f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6d6978696e2f6275696c642e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d504850556e6974266c6f676f3d676974687562) ](https://github.com/ui-awesome/html-mixin/actions/workflows/build.yml) [ ![Mutation Testing](https://camo.githubusercontent.com/6393e64799655b0a98f2018133bdc348ac1c768639cd971d0f8573780f2ecb04/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666f722d7468652d62616467652675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324675692d617765736f6d6525324668746d6c2d6d6978696e2532466d61696e) ](https://dashboard.stryker-mutator.io/reports/github.com/ui-awesome/html-mixin/main) [ ![PHPStan](https://camo.githubusercontent.com/a80f56cf67ac96f4ab29c6bdae18045b802cc1c36cb6b17e03f6d42e93561e04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f75692d617765736f6d652f68746d6c2d6d6978696e2f7374617469632e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d5048505374616e266c6f676f3d676974687562) ](https://github.com/ui-awesome/html-mixin/actions/workflows/static.yml)

 **A type-safe PHP mixin library for HTML tag rendering components**
 *Build reusable components with traits for attributes, content, templates, and prefix/suffix management.*

Features
--------

[](#features)

  ![Feature Overview](./docs/svgs/features.svg)### Installation

[](#installation)

```
composer require ui-awesome/html-mixin:^0.5
```

### Quick start

[](#quick-start)

#### Managing HTML attributes with HasAttributes

[](#managing-html-attributes-with-hasattributes)

The `HasAttributes` trait provides a fluent, immutable API for managing HTML attributes on elements. It supports enum keys/values, closure-based values, additive updates with `attributes()`, explicit replacement with `replaceAttributes()`, and `null` values for removing attributes.

```
