jaybizzle / crawler-detect
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
Requires
- php: >=7.1.0
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.5|^6.5|^7.5|^8.5.52|^9.4
- dev-master
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.121
- v1.2.120
- v1.2.119
- v1.2.118
- v1.2.117
- v1.2.116
- v1.2.115
- v1.2.114
- v1.2.113
- v1.2.112
- v1.2.111
- v1.2.110
- v1.2.109
- v1.2.108
- v1.2.107
- v1.2.106
- v1.2.105
- v1.2.104
- v1.2.103
- v1.2.102
- v1.2.101
- v1.2.100
- v1.2.99
- v1.2.98
- v1.2.97
- v1.2.96
- v1.2.95
- v1.2.94
- v1.2.93
- v1.2.92
- v1.2.91
- v1.2.90
- v1.2.89
- v1.2.88
- v1.2.87
- v1.2.86
- v1.2.85
- v1.2.84
- v1.2.83
- v1.2.82
- v1.2.81
- v1.2.80
- v1.2.79
- v1.2.78
- v1.2.77
- v1.2.76
- v1.2.75
- v1.2.74
- v1.2.73
- v1.2.72
- v1.2.71
- v1.2.70
- v1.2.69
- v1.2.68
- v1.2.67
- v1.2.66
- v1.2.65
- v1.2.64
- v1.2.63
- v1.2.62
- v1.2.61
- v1.2.60
- v1.2.59
- v1.2.58
- v1.2.57
- v1.2.56
- v1.2.55
- v1.2.54
- v1.2.53
- v1.2.52
- v1.2.51
- v1.2.50
- v1.2.49
- v1.2.48
- v1.2.47
- v1.2.46
- v1.2.45
- v1.2.44
- v1.2.43
- v1.2.42
- v1.2.41
- v1.2.40
- v1.2.39
- v1.2.38
- v1.2.37
- v1.2.36
- v1.2.35
- v1.2.34
- v1.2.33
- v1.2.32
- v1.2.31
- v1.2.30
- v1.2.29
- v1.2.28
- v1.2.27
- v1.2.26
- v1.2.25
- v1.2.24
- v1.2.23
- v1.2.22
- v1.2.21
- v1.2.20
- v1.2.19
- v1.2.18
- v1.2.17
- v1.2.16
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.17
- v1.1.16
- v1.1.15
- v1.1.14
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-updates
- dev-add-monitoring360bot
- dev-claude/optimize-regex-testing-P9RZa
- dev-copilot/review-and-improve-code
- dev-copilot/auto-commit-changes-on-merge
- dev-drop_php_5_support
This package is auto-updated.
Last update: 2026-04-14 19:36:09 UTC
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.phpand to the raw filesraw/Crawlers.jsonandraw/Crawlers.txt - adds the failing user agent string to
tests/crawlers.txt
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.