authanram/html
Composer 安装命令:
composer require authanram/html
包简介
WORK IN PROGRESS
关键字:
README 文档
README
Painless html generation.
Installation
You can install the package via composer.
composer require authanram/html
Basic Usage Example
Here's an example of how it can be used in a very basic way:
use Authanram\Html\Renderer; $qux = [ 'tag' => 'a', 'attributes' => [ 'href' => 'https://github.com/authanram', 'class' => 'text-blue-600', 'data-anchor' => true, ], 'contents' => [ 'authanram at github.com' ], ]; Renderer::renderFromArray($qux);
Renderer::renderFromArray($qux); will return the following string:
<a href="https://github.com/authanram" class="text-blue-600" data-anchor> authanram at github.com </a>
Nesting
use Authanram\Html\Renderer; $qux = [ 'tag' => 'p', 'contents' => [ [ 'tag' => 'a', 'attributes' => [ 'class' => 'text-blue-600', 'href' => 'https://github.com/authanram', ], 'contents' => [ [ 'tag' => 'span', 'class' => 'semibold', 'contents' => [ ['authanram at github.com'], ] ], ], ], ], ]; Renderer::renderFromArray($qux);
Renderer::renderFromArray($qux); will return the following string:
<p> <a class="text-blue-600" href="https://github.com/authanram"> <span class="semibold"> authanram at github.com </span> </a> </p>
Class Based Usage
As you can see here,
we can achieve the same result using the static method Authanram\Html\Element::make():
use Authanram\Html\Element; Element::make( 'a', [ 'href' => 'https://gitub.com', 'class' => 'text-blue-600', ], ['authanram at github.com'], )->render();
Abbreviation Based Usage
...
use Authanram\Html\Element; Element::parse('a.text-blue-600[href=https://gitub.com]') ->render();
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-23