PHPackages                             yiisoft/html - 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. [Framework](/categories/framework)
4. /
5. yiisoft/html

ActiveLibrary[Framework](/categories/framework)

yiisoft/html
============

Handy library to generate HTML

4.1.0(3w ago)58577.2k—0.8%23[8 issues](https://github.com/yiisoft/html/issues)20BSD-3-ClausePHPPHP 8.1 - 8.5CI passing

Since Mar 17Pushed 3w ago16 watchersCompare

[ Source](https://github.com/yiisoft/html)[ Packagist](https://packagist.org/packages/yiisoft/html)[ Docs](https://www.yiiframework.com/)[ GitHub Sponsors](https://github.com/sponsors/yiisoft)[ OpenCollective](https://opencollective.com/yiisoft)[ RSS](/packages/yiisoft-html/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (27)Versions (34)Used By (20)

 [ ![Yii](https://camo.githubusercontent.com/8317c17418b39410a660f5149071d26c5023c0d5fb2b7ebb771324812f666d73/68747470733a2f2f796969736f66742e6769746875622e696f2f646f63732f696d616765732f7969695f6c6f676f2e737667) ](https://github.com/yiisoft)

Yii HTML
========

[](#yii-html)

[![Latest Stable Version](https://camo.githubusercontent.com/ced6ff5c8c51fe0e42892a34e70c399a30b48cf0bf58827c2ffc4844f01fd0a3/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f68746d6c2f76)](https://packagist.org/packages/yiisoft/html)[![Total Downloads](https://camo.githubusercontent.com/df13bb8b345f627bd7fa33ed066e1c0fca0ab8067f603e36e16adf1064cf8686/68747470733a2f2f706f7365722e707567782e6f72672f796969736f66742f68746d6c2f646f776e6c6f616473)](https://packagist.org/packages/yiisoft/html)[![Build status](https://github.com/yiisoft/html/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/html/actions/workflows/build.yml)[![Code Coverage](https://camo.githubusercontent.com/f27787e4b2b4b73296304b3186722c5a23e07d1554b58cab0765a0c0c5a33f6f/68747470733a2f2f636f6465636f762e696f2f67682f796969736f66742f68746d6c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/yiisoft/html)[![Mutation testing badge](https://camo.githubusercontent.com/0face025866ab2f2cba8700ef8fcb5ac09365d925a8a972e82b1766cb74857ce/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246796969736f667425324668746d6c2532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/html/master)[![static analysis](https://github.com/yiisoft/html/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/html/actions?query=workflow%3A%22static+analysis%22)[![psalm-level](https://camo.githubusercontent.com/7f21d96ddf6eb129269542ad4d1758166f176183834761a49df3883d81107ef1/68747470733a2f2f73686570686572642e6465762f6769746875622f796969736f66742f68746d6c2f6c6576656c2e737667)](https://shepherd.dev/github/yiisoft/html)[![type-coverage](https://camo.githubusercontent.com/43424ff4725db9b3c0e4318f8196c2e38b35bb568de680fa69ad24777f7318ad/68747470733a2f2f73686570686572642e6465762f6769746875622f796969736f66742f68746d6c2f636f7665726167652e737667)](https://shepherd.dev/github/yiisoft/html)

The package provides various tools to help with dynamic server-side generation of HTML:

- Tag classes `A`, `Address`, `Article`, `Aside`, `Audio`, `B`, `Body`, `Br`, `Button`, `Caption`, `Col`, `Colgroup`, `Datalist`, `Div`, `Em`, `Fieldset`, `Footer`, `Form`, `H1`, `H2`, `H3`, `H4`, `H5`, `H6`, `Header`, `Hr`, `Hgroup`, `Html`, `I`, `Img`, `Input` (and specialized `Checkbox`, `Radio`, `Range`, `File`, `Color`), `Label`, `Legend`, `Li`, `Link`, `Meta`, `Nav`, `Noscript`, `Ol`, `Optgroup`, `Option`, `P`, `Picture`, `Script`, `Section`, `Select`, `Small`, `Source`, `Span`, `Strong`, `Style`, `Table`, `Tbody`, `Td`, `Textarea`, `Tfoot`, `Th`, `Thead`, `Title`, `Tr`, `Track`, `Ul`, `Video`.
- `CustomTag` class that helps to generate custom tag with any attributes.
- HTML widgets `ButtonGroup`, `CheckboxList` and `RadioList`.
- All tags content is automatically HTML-encoded. There is `NoEncode` class designed to wrap content that should not be encoded.
- `Html` helper that has static methods to generate HTML, create tags and HTML widget objects.

Note that for simple static-HTML cases, it is preferred to use HTML directly.

Requirements
------------

[](#requirements)

- PHP 8.1 - 8.5.

Installation
------------

[](#installation)

The package could be installed with [Composer](https://getcomposer.org):

```
composer require yiisoft/html
```

General usage
-------------

[](#general-usage)

```
