Crawler-Detect 0,1 coveralls travis-ci Packagist phpunit

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

3 years after MIT

CrawlerDetect

Build Status Total Downloads Scrutinizer Code Quality MIT Version StyleCI Coveralls branch

CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent and http_from header. Currently able to detect 100's of bots/spiders/crawlers.

Installation

Run composer require jaybizzle/crawler-detect 1.* or add "jaybizzle/crawler-detect" :"1.*" to your composer.json.

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 4/5, please see Laravel-Crawler-Detect

Parts of this class are based on the brilliant MobileDetect

Analytics

Related Repositories

node-crawler

node-crawler

Web Crawler/Spider for NodeJS + server-side jQuery ;-) ...

gocrawl

gocrawl

Polite, slim and concurrent web crawler. ...

fscrawler

fscrawler

Elasticsearch File System Crawler (FS Crawler) ...

Laravel-Crawler-Detect

Laravel-Crawler-Detect

A Laravel 4/5 wrapper for CrawlerDetect - the web crawler detection library ...

resources-i-like

resources-i-like

:books::100: Collection of learning resources i like ...


Top Contributors

JayBizzle MaxGiting GC-Mark romaricdrigon castevinz cwhsu1984 minhd nigelterry timersys dmitriynet jrean orthes piotrantosik alberto-bottarini

Dependencies

package version
php >=5.3.0
dev phpunit/phpunit 4.8.*
satooshi/php-coveralls 1.*

Releases

-   v1.2.20 zip tar
-   v1.2.19 zip tar
-   v1.2.18 zip tar
-   v1.2.17 zip tar
-   v1.2.16 zip tar
-   v1.2.15 zip tar
-   v1.2.14 zip tar
-   v1.2.13 zip tar
-   v1.2.12 zip tar
-   v1.2.11 zip tar
-   v1.2.10 zip tar
-   v1.2.9 zip tar
-   v1.2.8 zip tar
-   v1.2.7 zip tar
-   v1.2.6 zip tar
-   v1.2.5 zip tar
-   v1.2.4 zip tar
-   v1.2.3 zip tar
-   v1.2.2 zip tar
-   v1.2.1 zip tar
-   v1.2.0 zip tar
-   v1.1.17 zip tar
-   v1.1.16 zip tar
-   v1.1.15 zip tar
-   v1.1.14 zip tar
-   v1.1.13 zip tar
-   v1.1.12 zip tar
-   v1.1.11 zip tar
-   v1.1.10 zip tar
-   v1.1.9 zip tar