jaybizzle/crawler-detect
Composer 安装命令:
composer require jaybizzle/crawler-detect
包简介
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
README 文档
README
About
CrawlerDetect is a PHP library for detecting bots, crawlers and spiders via the User-Agent and HTTP_FROM headers. It currently recognises thousands of user agents and is updated regularly.
Installation
composer require jaybizzle/crawler-detect
Usage
use Jaybizzle\CrawlerDetect\CrawlerDetect; $CrawlerDetect = new CrawlerDetect; // Check the user agent of the current visitor if ($CrawlerDetect->isCrawler()) { // true if a crawler user agent was detected } // Pass a user agent as a string if ($CrawlerDetect->isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)')) { // true if a crawler user agent was detected } // Output the name of the bot that matched (if any) echo $CrawlerDetect->getMatches();
Contributing
If you find a bot, spider or crawler that CrawlerDetect fails to detect, please open a pull request that:
- adds the regex pattern to the
$dataarray insrc/Fixtures/Crawlers.php - adds the failing user agent string to
tests/data/user_agent/crawlers.txt
The raw/Crawlers.json and raw/Crawlers.txt files are regenerated automatically by export.php after merge — no need to touch them.
If you're not able to submit a PR, open an issue with the user agent string and we'll take it from there.
Ports & Integrations
CrawlerDetect has been ported to a number of other languages and frameworks. If you maintain a port not listed here, please open a PR.
| Platform | Project |
|---|---|
| Laravel | Laravel-Crawler-Detect |
| Symfony 2 / 3 / 4 | CrawlerDetectBundle |
| Yii2 | yii2-crawler-detect |
| Node.js / ES6 | es6-crawler-detect |
| Python | crawlerdetect |
| JVM (Java, Scala, Kotlin) | CrawlerDetect |
| .NET / .NET Core | NetCrawlerDetect |
| Ruby | crawler_detect |
| Go | crawlerdetect |
Credits
Parts of this library are based on the excellent MobileDetect.
License
Released under the MIT License.
jaybizzle/crawler-detect 适用场景与选型建议
jaybizzle/crawler-detect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 104.79M 次下载、GitHub Stars 达 2.36k, 最近一次更新时间为 2015 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「crawler」 「crawler detect」 「crawler detector」 「php crawler detect」 「crawlerdetect」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jaybizzle/crawler-detect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaybizzle/crawler-detect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jaybizzle/crawler-detect 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A lightweight, dependency free PHP class that acts as wrapper for Crawlbase API
Shim repository for phpmd/phpmd
A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language
Parses a user agent string to detect Internet Explorer
Sitemap crawler/generator. For the given URL it will return sitemap XML file with URLs and images.
统计信息
- 总下载量: 104.79M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2383
- 点击次数: 33
- 依赖项目数: 245
- 推荐数: 4
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-23