jaybizzle / crawler-detect
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
Installs: 68 322 332
Dependents: 204
Suggesters: 4
Security: 0
Stars: 1 992
Watchers: 53
Forks: 259
Open Issues: 11
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.5|^6.5|^9.4
- dev-master
- 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-drop_php_5_support
This package is auto-updated.
Last update: 2024-11-04 19:17:08 UTC
README
About CrawlerDetect
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
and http_from
header. Currently able to detect 1,000's of bots/spiders/crawlers.
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 crawler user agent 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 crawler user agent detected } // Output the name of the bot that matched (if any) echo $CrawlerDetect->getMatches();
Contributing
If you find a bot/spider/crawler user agent that CrawlerDetect fails to detect, please submit a pull request with the regex pattern added to the $data
array in Fixtures/Crawlers.php
and add the failing user agent to tests/crawlers.txt
.
Failing that, just create an issue with the user agent you have found, and we'll take it from there :)
Laravel Package
If you would like to use this with Laravel, please see Laravel-Crawler-Detect
Symfony Bundle
To use this library with Symfony 2/3/4, check out the CrawlerDetectBundle.
YII2 Extension
To use this library with the YII2 framework, check out yii2-crawler-detect.
ES6 Library
To use this library with NodeJS or any ES6 application based, check out es6-crawler-detect.
Python Library
To use this library in a Python project, check out crawlerdetect.
JVM Library (written in Java)
To use this library in a JVM project (including Java, Scala, Kotlin, etc.), check out CrawlerDetect.
.NET Library
To use this library in a .net standard (including .net core) based project, check out NetCrawlerDetect.
Ruby Gem
To use this library with Ruby on Rails or any Ruby-based application, check out crawler_detect gem.
Go Module
To use this library with Go, check out the crawlerdetect module.
Parts of this class are based on the brilliant MobileDetect