room11/dom-utils
Composer 安装命令:
composer require room11/dom-utils
包简介
Utility functions for the PHP DOM extension
README 文档
README
Utility functions for the PHP DOM extension.
Required PHP Version
- PHP 7.0+
Installation
$ composer require room11/dom-utils
Usage
default_charset
Gets and sets the default charset used by DOMUtils functions.
default_charset(string $charSet = ''): string
When the supplied $charSet is empty, just return the current value. When a new value is supplied, change the
default and return the old one.
string $charSet- The new default character set.
domdocument_load_html
Loads a HTML string into a DOMDocument object, with error handling and character set normalization.
domdocument_load_html(string $html, int $options = 0, string $charSet = ''): \DOMDocument
Loads a HTML string into a DOMDocument object, with error handling and character set normalization.
string $html- The HTML string to load.int $options- A bit mask of LibXML options to use when loading the document.string $charSet- The character set to use when loading the document. Defaults todefault_charset().
Throws a LibXMLFatalErrorException when loading the document fails.
domdocument_process_html_docs
Processes a set of HTML strings into DOMDocument objects and invokes a callback for each one.
domdocument_process_html_docs($htmlStrings, callable $callback, int $options = 0, string $charSet = ''): \DOMDocument
A DOMDocument object will be passed to the first argument of the callback, and an array of LibXMLError objects for the document to the second. The third argument is a boolean which is true if the document could not be loaded. The callback may return boolean false to break the iteration. Any other return value will be ignored.
string[] $htmlStrings- An iterable set of HTML strings to process.callable(\DOMDocument, \LibXMLError[], bool) $callback- The callback to invoke for each document.int $options- A bit mask of LibXML options to use when loading the documents.string $charSet- The character set to use when loading the documents. Defaults todefault_charset().
room11/dom-utils 适用场景与选型建议
room11/dom-utils 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.36k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 room11/dom-utils 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 room11/dom-utils 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 13
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-05-06