PHPackages                             qingbing/php-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. qingbing/php-html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

qingbing/php-html
=================

html 各种标签的渲染

1.0.1(7y ago)020512MITPHP

Since Dec 29Pushed 6y agoCompare

[ Source](https://github.com/qingbing/php-html)[ Packagist](https://packagist.org/packages/qingbing/php-html)[ Docs](http://www.phpcorner.net)[ RSS](/packages/qingbing-php-html/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (4)Versions (2)Used By (12)

php-html
========

[](#php-html)

html 各种标签的渲染

注意事项
----

[](#注意事项)

- ClientScript
    - 向html中加入css、script标签等
    - ClientScript::getInstance()-&gt;...;
- Html
    - 支持常见的 html-encode、html-decode、meta、css、script、input-text、input-password、input-radio、input-checkbox、textarea、button、image-button、reset-button、submit-button、select、form等标签
    - active... ： 支持带入某个具体的model类，这个model必须是"\\Abstracts\\Model"的子类

使用方法
----

[](#使用方法)

### ClientScript 使用方法

[](#clientscript-使用方法)

```
ClientScript::getInstance()->registerCssFile($url, $media = '');
ClientScript::getInstance()->registerScriptFile($url, $position = self::POS_HEAD);
ClientScript::getInstance()->render(&$output);
```

### Html 使用方法

[](#html-使用方法)

```
$str = Html::beginForm(['', "c" => "TestHtml", "do" => "1",], 'get');
echo $str . "\n";

$str = Html::encode(' code ');
echo $str . "\n";

$str = Html::decode('&lt;div&gt; code &lt;/div&gt;');
echo $str . "\n";

$str = Html::cdata("attr");
echo $str . "\n";

$str = Html::tag('input', ['id' => 'tag'], '11', false);
echo $str . "\n";

$str = Html::link('This is a link', 'http://www.baidu.com', []);
echo $str . "\n";

// 生成 link-meta 属性，需要通过 \ClientScript::getInstance()->render($html); // 来渲染
Html::refresh('This is a link', 'http://www.baidu.com');

$str = Html::openTag('div', ['id' => 'openTag']) . ' Content ' . Html::closeTag('div');
echo $str . "\n";

$str = Html::metaTag('This is description.', 'description', 'content-type', []);
echo $str . "\n";

$str = Html::linkTag(null, 'description', '/public/css/main.css', null, []);
echo $str . "\n";

$str = Html::css("body{font-size:18px;}");
echo $str . "\n";

$str = Html::cssFile('/public/css/main.css');
echo $str . "\n";

$str = Html::script('console.log(123);');
echo $str . "\n";

$str = Html::scriptFile('/public/css/main.js');
echo $str . "\n";

$str = Html::label('This is a label.');
echo $str . "\n";

$str = Html::mailto('This is a label.', '780042175@qqb.com');
echo $str . "\n";

$str = Html::image('/public/img/1.png', '消息');
echo $str . "\n";

$str = Html::button('SingleTagButton');
echo $str . "\n";

$str = Html::htmlButton('DoubleTagButton');
echo $str . "\n";

$str = Html::submitButton('SubmitButton');
echo $str . "\n";

$str = Html::resetButton('ResetButton');
echo $str . "\n";

$str = Html::imageButton('/public/img/1.png');
echo $str . "\n";

$str = Html::linkButton('LinkButton');
echo $str . "\n";

$str = Html::textField('textField', 'TextField', []);
echo $str . "\n";

$str = Html::passwordField('passwordField', 'PasswordField', []);
echo $str . "\n";

$str = Html::fileField('fileField', []);
echo $str . "\n";

$str = Html::hiddenField('hidden[Field]', 'hiddenField', []);
echo $str . "\n";

$str = Html::textArea('textArea', 'textArea', []);
echo $str . "\n";

$str = Html::radioButton('radioButton', true, []);
echo $str . "\n";

$str = Html::radioButtonList('radioButtonList', 'pear', [
    'pear' => '梨子',
    'apple' => '苹果',
    'banana' => '香蕉',
]);
echo $str . "\n";

$str = Html::checkBox('checkBox', true, []);
echo $str . "\n";

$str = Html::checkBoxList('radioButtonList', ['pear', 'apple'], [
    'pear' => '梨子',
    'apple' => '苹果',
    'banana' => '香蕉',
]);
echo $str . "\n";

$str = Html::dropDownList('dropDownList', 'apple', [
    'pear' => '梨子',
    'apple' => '苹果',
    'banana' => '香蕉',
]);
echo $str . "\n";

$str = Html::listBox('listBox', ['apple', 'banana'], [
    'pear' => '梨子',
    'apple' => '苹果',
    'banana' => '香蕉',
], [
    'multiple' => '1'
]);
echo $str . "\n";

$str = Html::endForm();
echo $str . "\n";
```

### Html(active...) 使用方法

[](#htmlactive-使用方法)

```
$model = new TestModel();
$rString = '';

$rString .= '' . Html::activeLabel($model, 'textField') . '';
$rString .= '' . Html::activeTextField($model, 'textField') . '';

$rString .= '' . Html::activeLabel($model, 'hiddenField') . '';
$rString .= '' . Html::activeHiddenField($model, 'hiddenField') . '';

$rString .= '' . Html::activeLabel($model, 'passwordField') . '';
$rString .= '' . Html::activePasswordField($model, 'passwordField') . '';

$rString .= '' . Html::activeLabel($model, 'fileField') . '';
$rString .= '' . Html::activeFileField($model, 'fileField') . '';

$rString .= '' . Html::activeLabel($model, 'textarea') . '';
$rString .= '' . Html::activeTextArea($model, 'textarea') . '';

$rString .= '' . Html::activeLabel($model, 'radioButton') . '';
$rString .= '' . Html::activeRadioButton($model, 'radioButton') . '';

$rString .= '' . Html::activeLabel($model, 'checkbox') . '';
$rString .= '' . Html::activeCheckbox($model, 'checkbox') . '';

$rString .= '' . Html::activeLabel($model, 'dropDownlist') . '';
$rString .= '' . Html::activeDropDownList($model, 'dropDownlist', TestModel::dropDownlist()) . '';

$rString .= '' . Html::activeLabel($model, 'listbox') . '';
$rString .= '' . Html::activeListBox($model, 'listbox', TestModel::dropDownlist()) . '';

$rString .= '' . Html::activeLabel($model, 'checkboxList') . '';
$rString .= '' . Html::activeCheckboxList($model, 'checkboxList', TestModel::dropDownlist()) . '';

$rString .= '' . Html::activeLabel($model, 'radioButtonList') . '';
$rString .= '' . Html::activeRadioButtonList($model, 'radioButtonList', TestModel::dropDownlist()) . '';

$rString .= '';
echo $rString;
```

====== 异常代码集合 ======
--------------------

[](#-异常代码集合-)

异常代码格式：1020 - XXX - XX （组件编号 - 文件编号 - 代码内异常）

```
 - 无

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2696d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9379d2ee4885074de75faa3fa12970614186826f762df3c4aa0905dc1ff3b513?d=identicon)[qingbing](/maintainers/qingbing)

---

Top Contributors

[![qingbing](https://avatars.githubusercontent.com/u/33932784?v=4)](https://github.com/qingbing "qingbing (3 commits)")

---

Tags

phphtmlformclientscriptactive-html

### Embed Badge

![Health badge](/badges/qingbing-php-html/health.svg)

```
[![Health](https://phpackages.com/badges/qingbing-php-html/health.svg)](https://phpackages.com/packages/qingbing-php-html)
```

###  Alternatives

[okipa/laravel-form-components

Ready-to-use and customizable form components.

198.0k1](/packages/okipa-laravel-form-components)[artem_c/emmet

emmet implementation for php

141.8k](/packages/artem-c-emmet)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
