asmundstavdahl/html 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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&period;
    </p>
    <label for="test_input">Test input</label><input id="test_input" type="text">
  </body>
</html>

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固