esayers/html
Composer 安装命令:
composer require esayers/html
包简介
Generate HTML through PHP
README 文档
README
Generate HTML with PHP
Usage
Basic example
echo Html::div( Html::p('Example Text', ['class' => 'stylish']) );
Output:
<div><p class="stylish">Example Text</p></div>
Html
Create HTML tags using the static Html class.
echo Html::p('Paragraph text');
Output:
<p>Paragraph text</p>
Nesting tags
echo Html::div( Html::section([ Html::h2('Heading'), Html::p('Amazing paragraph') ] ) );
Output:
<div><section><h2>Heading</h2><p>paragraph</p></section></div>
Adding attributes
echo Html::div() ->id("2") ->class(['class1', 'class2']);
Output:
<div id="2" class="class1 class2"></div>
Tag-specific attributes:
echo Html::input() ->type("checkbox") ->checked(true);
Output:
<input type="checkbox" checked/>
Content automatically encoded
echo Html::div('> <') ->id(">") ->class(['clas"s1', 'class2']);
Output:
<div id=">" class="clas"s1 class2">> <</div>
Supported Tags
a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, label, legend, li, link, main, map, mark, menu, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, search, section, select, small, source, span, strike, strong, style, sub, summary, sup, svg, table, tbody, td, template, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr
Supported Attributes
accept, accesskey, action, align, alt, async, autocomplete, autofocus, autoplay, bgcolor, border, charset, checked, cite, class, color, cols, colspan, content, contenteditable, controls, coords, data, datetime, default, defer, dir, dirname, disabled, download, draggable, enctype, enterkeyhint, for, form, formaction, headers, height, hidden, high, href, hreflang, http-equiv, id, inert, inputmode, ismap, kind, label, lang, list, loop, low, max, maxlength, media, method, min, multiple, muted, name, novalidate, open, optimum, pattern, ping, placeholder, popover, popovertarget, popovertargetaction, poster, preload, readonly, rel, required, reversed, rows, rowspan, sandbox, scope, selected, shape, size, sizes, span, spellcheck, src, srcdoc, srclang, srcset, start, step, style, tabindex, target, title, translate, type, usemap, value, width, wrap
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-06