czepter/phpscraper
Composer 安装命令:
composer require czepter/phpscraper
包简介
An oppinionated way to access the web. See tests/ for examples.
README 文档
README
PHP Scraper
An opinionated & limited way to scrape the web using PHP. The main goal is to get stuff done instead of getting distracted with xPath selectors, preparing data structures, etc. Instead, you can just "go to a website" and get an array with all details relevant to your scraping project.
Under the hood, it uses Goutte and a few other packages. See composer.json.
Sponsors
This project is sponsored by:
Want to sponsor this project? Contact me.
Examples
Here are a few impressions on the way the library works. More examples are on the project website.
Get the Title of a Website
All scraping functionality can be accessed either as a function call or a property call. On the example of title scraping this would like like this:
$web = new \spekulatius\phpscraper(); $web->go('https://google.com'); // Returns "Google" echo $web->title; // Also returns "Google" echo $web->title();
Scrape the Images from a Website
Scraping the images including the attributes of the img-tags:
$web = new \spekulatius\phpscraper(); /** * Navigate to the test page. * * This page contains twice the image "cat.jpg". * Once with a relative path and once with an absolute path. */ $web->go('https://test-pages.phpscraper.de/meta/lorem-ipsum.html'); var_dump($web->imagesWithDetails); /** * Contains: * * [ * 'url' => 'https://test-pages.phpscraper.de/assets/cat.jpg', * 'alt' => 'absolute path', * 'width' => null, * 'height' => null, * ], * [ * 'url' => 'https://test-pages.phpscraper.de/assets/cat.jpg', * 'alt' => 'relative path', * 'width' => null, * 'height' => null, * ] */
See the full documentation for more information and examples.
czepter/phpscraper 适用场景与选型建议
czepter/phpscraper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「PHP Library」 「web scraping」 「PHP scraper」 「PHP scraping」 「web-access」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 czepter/phpscraper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 czepter/phpscraper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 czepter/phpscraper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Model of a web-based resource
Retrieve a WebResourceInterface instance over HTTP
Inbox pattern process implementation for your Laravel Applications
Core library that defines common interfaces used by the rest of the intahwebz..
Amqp classes
Selectize Theme for Bootstrap 4
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2021-03-17
