Download the PHP package zxf/dom without Composer

On this page you can find all versions of the php package zxf/dom. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dom

zxf/dom - 强大的 PHP DOM 操作库

一个功能强大、易于使用的 PHP DOM 操作库,提供简洁的 API 来解析、查询和操作 HTML/XML 文档。

🇺🇸 Read English Documentation (README_EN.md)

特性

系统要求

安装

使用 Composer 安装

手动安装

快速开始

基本用法

从远程 URL 加载文档

注意: 从远程 URL 加载需要启用 cURL 扩展。

XML 文档处理

链式调用

支持的选择器

CSS 选择器(70+ 种)

基础选择器:

属性选择器:

伪类(60+ 种):

伪元素:

XPath 选择器

API 参考

Document

代表 HTML/XML 文档的主文档类。

从远程 URL 加载文档

注意: 从远程 URL 加载需要启用 cURL 扩展。

Element

代表文档中的一个元素。

ClassAttribute

管理元素的类属性。

StyleAttribute

管理元素的样式属性。

Encoder

编码/解码工具类。

Errors

错误处理工具。

示例

示例 1:查找元素

示例 2:修改元素

示例 3:网页爬虫

示例 4:表格数据提取

性能优化建议

  1. 使用更具体的选择器 - 更具体的选择器速度更快

  2. 缓存查询结果 - 存储频繁使用的元素

  3. 使用 ID 选择器 - ID 选择器是最快的

测试

运行测试套件:

运行示例:

文档

贡献

欢迎贡献!请随时提交 Pull Request。

许可证

MIT License

支持

如有问题和疑问,请使用 GitHub 问题跟踪器。


版本: 2.0.0
最后更新: 2026-05-14


附录:快速参数参考

selectors 数组参数格式(findWithFallback)

extractTable 选项

extractList 选项

queryMatrix 选项

Document 类常用方法速查

方法 功能 参数
find() 查找元素 (expression, type='css', contextNode=null)
first() 查找首个 (expression, type='css', contextNode=null)
xpath() XPath 查询 (xpathExpression)
regex() 正则查找 (pattern, contextNode=null, attribute=null)
findByText() 文本查找 (text, selector='*')
findByAttribute() 属性查找 (attribute, value=null, selector='*')
findByData() data属性查找 (dataName, value=null, selector='*')
findByPath() 路径查找 (path, relative=false)
extractTable() 提取表格 (table=null, options=[])
extractList() 提取列表 (list=null, options=[])
extractFormData() 提取表单 (form=null)
findWithFallback() 回退查找 (selectors, contextNode=null, getFirst=true)
queryMatrix() 矩阵数据 (container='div', options=[])

详细完整参数说明请参考 src/docs/RULE_GUIDE.md(选择器规则说明文档)和 src/docs/USER_GUIDE.md(完整使用指南)。


All versions of dom with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zxf/dom contains the following files

Loading the files please wait ...