承接 ui-awesome/html 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ui-awesome/html

Composer 安装命令:

composer require ui-awesome/html

包简介

UI Awesome HTML Code Generator for PHP.

README 文档

README

UI Awesome

Html


PHPUnit Mutation Testing PHPStan

A fluent, immutable PHP library for generating HTML elements with typed attribute helpers.
Safe by default content encoding, raw HTML when needed, and standards-compliant rendering.

Features

Feature Overview

Installation

composer require ui-awesome/html:^0.4

Quick start

This package provides immutable, fluent wrapper classes for common HTML elements.

It supports safe content encoding via content(), raw HTML via html(), and composition using element instances.

Document skeleton + composition + immutability

use UIAwesome\Html\Flow\{Div, Main, P};
use UIAwesome\Html\Heading\H1;
use UIAwesome\Html\Metadata\{Link, Meta, Title};
use UIAwesome\Html\Palpable\A;
use UIAwesome\Html\Root\{Body, Head, Html};

$baseLink = A::tag()->class('nav-link');

echo Html::tag()
    ->lang('en')
    ->html(
        Head::tag()->html(
            Meta::tag()->charset('utf-8'),
            Meta::tag()->name('viewport')->content('width=device-width, initial-scale=1'),
            Title::tag()->content('UI Awesome HTML'),
            Link::tag()->rel('stylesheet')->href('/assets/app.css'),
        ),
        Body::tag()->class('app')->html(
            Main::tag()->class('container')->html(
                H1::tag()->content('UI Awesome HTML'),
                P::tag()->content('Build HTML with a fluent, immutable API.'),
                Div::tag()->class('nav')->html(
                    $baseLink->href('/docs')->content('Documentation'),
                    $baseLink->href('/github')->content('GitHub'),
                ),
            ),
        ),
    )
    ->render();

Safe content vs raw HTML

use UIAwesome\Html\Flow\Div;

echo Div::tag()->content('<strong>encoded</strong>')->render();
// <div>&lt;strong&gt;encoded&lt;/strong&gt;</div>

echo Div::tag()->html('<strong>raw</strong>')->render();
// <div>
// <strong>raw</strong>
// </div>

Powerful list composition

Create ordered lists, unordered lists, and description lists with a fluent API.

use UIAwesome\Html\List\{Dl, Ol, Ul};

// Unordered list with items
$features = Ul::tag()
    ->class('feature-list')
    ->items(
        'Immutable by design',
        'Type-safe attributes',
        'Fluent API',
        'Standards-compliant',
    );

// Ordered list with custom start and nested items
$steps = Ol::tag()
    ->class('steps')
    ->start(1)
    ->reversed(false)
    ->li('Install with Composer', 1)
    ->li('Create HTML elements', 2)
    ->li('Render to string', 3);

// Description list for metadata or glossaries
$metadata = Dl::tag()
    ->class('metadata-list')
    ->dt('Package')
    ->dd('ui-awesome/html')
    ->dt('Version')
    ->dd('0.4.0')
    ->dt('License')
    ->dd('BSD-3-Clause');

// Render all lists
$html = $features->render() . PHP_EOL . $steps->render() . PHP_EOL . $metadata->render();

Documentation

For detailed testing and quality workflows.

Package information

PHP Latest Stable Version Total Downloads

Quality code

Codecov PHPStan Level Max Super-Linter StyleCI

Our social networks

Follow on X

License

License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2024-03-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固