aammui/laravel-parser
Composer 安装命令:
composer require aammui/laravel-parser
包简介
HTML parser for Laravel/PHP
README 文档
README
HTML parser for Laravel/PHP.
Introduction
This packages parses html responses, with very efficient APIs. But it doesn't parse any url.
This package is Laravel wrapper of https://github.com/symfony/dom-crawler
Installation
composer require aammui/laravel-parser
Uses
use Aammui\LaravelParser\Facade\PHPSoup; $html = <<<END <html lang="en"> <head> <title> The Dormouse's story </title> </head> <body> <p class="title"> <b> The Dormouse's story </b> </p> <p class="story"> Once upon a time there were three little sisters; and their names were <a class="sister" href="http://example.com/elsie" id="link1"> Elsie </a> , <a class="sister" href="http://example.com/lacie" id="link2"> Lacie </a> and <a class="sister" href="http://example.com/tillie" id="link3"> Tillie </a> ; and they lived at the bottom of a well. </p> <p class="story"> ... </p> </body> </html> END; $soup = PHPSoup::Parse($html); // Outputs: <title>The Dormouse's story</title> echo $soup->get('title')->first()->outerHtml(); // Outputs: The Dormouse's story echo $soup->get('title')->first()->text(); // Output: echo $soup->get('p')->first()->attributes("href"); // [<a class="sister" href="http://example.com/elsie" id="link1">Elsie</a>, // <a class="sister" href="http://example.com/lacie" id="link2">Lacie</a>, // <a class="sister" href="http://example.com/tillie" id="link3">Tillie</a>] echo $soup->get("a"); // Search by attributes echo $soup->get("li[data-item]")->outerHtml(); echo $soup->get("li[data-item='2']")->outerHtml(); // Search by Css echo $soup->get("head > title")->outerHtml(); # [<title>The Dormouse's story</title>] // Find the siblings of tags: echo $soup->get("#link1 ~ .sister")->outerHtml(); # [<a class="sister" href="http://example.com/lacie" id="link2">Lacie</a>, # <a class="sister" href="http://example.com/tillie" id="link3">Tillie</a>]
aammui/laravel-parser 适用场景与选型建议
aammui/laravel-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 56 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aammui/laravel-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aammui/laravel-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-30