定制 progphil1337/php-html 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

progphil1337/php-html

最新稳定版本:v1.0.2

Composer 安装命令:

composer require progphil1337/php-html

包简介

Create HTML code using PHP

README 文档

README

Create valid HTML code with PHP

Installation

Install with composer:

$ composer require progphil1337/php-html

Compatibility

ProgPhil1337\HTML requires PHP 8.1 (or better).

Usage

Basic example

use ProgPhil1337\HTML\Attribute\Style;
use ProgPhil1337\HTML\Element;

$html = new Element('html');

// Create <head> with <title>
$head = new Element('head');
$title = new Element('title');
$title->innerText('Website Title');

$head->add($title);

$html->add($head);

// Create <body> with styled box
$body = new Element('body');
$body->add(new Style([
    'background-color' => '#ecf0f1',
    'width' => '600px',
    'margin' => '0 auto'
]));

$div = new Element('div');
$div->add(new Style([
    'background-color' => 'white',
    'margin-top' => '50px',
    'border-radius' => '3px',
    'padding' => '13px'
]));

$div->appendHTML('<h1>PHP-HTML</h1><br />');
$div->appendText('Create valid HTML code with PHP.');

$body->add($div);
$html->add($body);

echo $html;

Outputs the following HTML code:

<html>
<head>
<title>
Website Title
</title>
</head>
<body style="background-color:#ecf0f1;width:600px;margin:0 auto">
<div style="background-color:white;margin-top:50px;border-radius:3px;padding:13px">
<h1>PHP-HTML</h1><br />
Create valid HTML code with PHP.
</div>
</body>
</html>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固