定制 jaybizzle/crawler-detect 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jaybizzle/crawler-detect

最新稳定版本:v1.4.0

Composer 安装命令:

composer require jaybizzle/crawler-detect

包简介

CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent

README 文档

README

CrawlerDetect

crawlerdetect.io

Build Status Downloads Latest Version Coverage License

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 $data array in src/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.

统计信息

  • 总下载量: 102.51M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2383
  • 点击次数: 17
  • 依赖项目数: 244
  • 推荐数: 4

GitHub 信息

  • Stars: 2360
  • Watchers: 58
  • Forks: 278
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固