asmundstavdahl/html
Composer 安装命令:
composer require asmundstavdahl/html
包简介
HTML made programatically
README 文档
README
Usage
composer require asmundstavdahl/html
<?php require_once 'vendor/autoload.php'; use AsmundStavdahl\HTML; # Include element function definitions new HTML\Elements; $nodeTree = HTML\HTML(["lang" => "en"], [ HTML\HEAD([], [ HTML\TITLE([], ["Test of html-builder"]) , HTML\STYLE([], [ "h1 { color: red; } .im-blue { color: lightblue; }" ]) ]) , HTML\BODY([], [ HTML\H1([], ["This is a test"]) , HTML\P([], [ "Strings become text nodes." , HTML\BR() , HTML\TEXT("You can also be more explicit and make a text node using the TEXT function.") ]) , HTML\LABEL(["for" => "test_input"], ["Test input"]) , HTML\INPUT(["id" => "test_input", "type" => "text"]) ]) ]); $htmlConfig = new HTML\HtmlConfig( true, # pretty formating with indentation " " # indent with two spaces ); $html = $nodeTree->toHTML($htmlConfig);
The resulting $html would be this string:
<!DOCTYPE html> <html lang="en"> <head> <title> Test of html-builder </title> <style> h1 { color: red; } .im-blue { color: lightblue; } </style> </head> <body> <h1> This is a test </h1> <p> Strings become text nodes. <br> You can also be more explicit and make a text node using the TEXT function. </p> <label for="test_input">Test input</label><input id="test_input" type="text"> </body> </html>
统计信息
- 总下载量: 46
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-08