krzysztofzylka/html-generator
最新稳定版本:2.0.6
Composer 安装命令:
composer require krzysztofzylka/html-generator
包简介
HTML generator
README 文档
README
Html generator in PHP
Usage
Static create tag
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag('div')
or
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag( 'div', 'content' )
or
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag( 'div', 'content', 'classes' )
or
echo \Krzysztofzylka\HtmlGenerator\HtmlGenerator::createTag( 'div', 'content', 'classes', ['attributes' => 'value'] )
Create tag
echo new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div');
Methods
Set content
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->setContent('content')
Get content
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->getContent()
Append content
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->appendContent('append content')
Add attributes
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->addAttributes(['id' => 'div-id', 'class' => 'classes'])
Add attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->addAttribute('id', 'div-id')
Get attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->getAttribute('id')
Append string to attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->appendAttribute('class', 'next_class')
Remove attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->removeAttribute('class')
Add id attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->setId('div-id')
Add name attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('input')) ->setName('input-name')
Add class attribute
echo (new \Krzysztofzylka\HtmlGenerator\HtmlGenerator('div')) ->setClass('class')
统计信息
- 总下载量: 779
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-02