ytekeli/dom-selector
Composer 安装命令:
composer require ytekeli/dom-selector
包简介
An HTML DOM selector and extractor with using YAML config.
README 文档
README
An HTML DOM selector and extractor with using YAML config.
- Free software: MIT license
Requirements
- PHP ^7.3 | ^8.0
- ext-yaml
Install
Install the latest version using composer.
$ composer require ytekeli/dom-selector
This package can be found on packagist and is best loaded using composer. We support php 7.3, 7.4 and 8.0.
Example
You can find many examples of how to use the DOM Selector in the tests directory.
// Assuming you installed from Composer: require "vendor/autoload.php"; use DOMSelector\DOMSelector; $yaml_string = ' title: css: "h1" type: Text link: css: "h2 a" type: Link'; $selector = DOMSelector::fromYamlString($yaml_string); $extracted = $selector->extract('<h1>Title</h1><h2>Usage <a class="headerlink" href="https://example.com">¶</a></h2>'); print_r($extracted);
// output
Array
(
[title] => Title
[link] => https://example.com
)
We strongly inspired by selectorlib written with python.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-25