quentinbuiteman/easy-dom
最新稳定版本:v1.1.0
Composer 安装命令:
composer require quentinbuiteman/easy-dom
包简介
Extend DOMDocument with some easy-of-use functionality.
README 文档
README
Extend DOMDocument with some easy-of-use functionality.
Installation
composer require quentinbuiteman/easy-dom
Usage
use \EasyDOM\DOMDocument;
// Initliaze new DOMDocument with preserveWhiteSpace = false and formatOutput = true
$DOM = new DOMDocument();
/**
* Example to create a new element
*
* First parameter determines which element to create
* Second parameter is an array of attributes to use in element creation (optional)
* Third parameter is the text for inside the element (optional)
*/
$atts = array('class' => 'text');
$p = $this->DOM->generateElement('p', $atts, 'This will be the text inside the paragraph.');
$this->DOM->appendChild($p);
/**
* Example to add nodes to an element based on a HTML string
*/
$html = '<p>This is a test HTML string.</p>';
$div = $this->DOM->createElement('div');
$div->addInnerHTML($html);
统计信息
- 总下载量: 1.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-04