Laravel Crawler Detect

jaybizzle/laravel-crawler-detect image

Laravel Crawler Detect stats

Downloads
1.3M
Stars
294
Open Issues
2
Forks
29

View on GitHub →

A Laravel package to detect web crawlers via the user agent

Laravel Crawler Detect

A Laravel wrapper for CrawlerDetect - the web crawler detection library

Installation

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

The last version compatible with Laravel 4 was v1.0.2 so if you need that, you will have to fix your composer.json to that specific version.

Add the following to the providers array in your config/app.php file..

Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider::class,

...and the following to your aliases array...

'Crawler' => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class,

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Usage

use Crawler;
 
// Check current 'visitors' user agent
if(Crawler::isCrawler()) {
// true if crawler user agent detected
}
 
 
// Pass a user agent as a string
if(Crawler::isCrawler('Mozilla/5.0 (compatible; aiHitBot/2.9; +https://www.aihitdata.com/about)')) {
// true if crawler user agent detected
}
JayBizzle photo

Father of two, Airplane Geek, Beer Lover, Yorkshire to the core, Rugby League fan, Tech Nerd!

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Jaybizzle Laravel Crawler Detect Related Articles

Serve Markdown Versions of Your Laravel Pages to AI Agents image

Serve Markdown Versions of Your Laravel Pages to AI Agents

Read article
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum