百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

Laravel-Crawler-Detect

> 后端框架
开源

一个用于 CrawlerDetect - 网络爬虫检测库的 Laravel 封装

325 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个用于 CrawlerDetect - 网络爬虫检测库的 Laravel 封装

Laravel Crawler Detect

A Laravel wrapper for Crawler-Detect - the web crawler detection library.

Requirements

  • PHP 8.1+
  • Laravel 10, 11, 12 or 13

Need support for an older version of Laravel or PHP? Use v1.3.0 of this package.

Installation

bash
composer require jaybizzle/laravel-crawler-detect

The service provider and the Crawler facade alias are registered automatically via package auto-discovery.

Usage

php
use Crawler;

// Check the current visitor's user agent
if (Crawler::isCrawler()) {
    // true if a crawler user agent was detected
}

// Or pass a user agent string to check
if (Crawler::isCrawler('Mozilla/5.0 (compatible; aiHitBot/2.9; +https://www.aihitdata.com/about)')) {
    // true if a crawler user agent was detected
}

// Output the name of the bot that matched (if any)
echo Crawler::getMatches();

You can also type-hint the underlying class and let the container inject it:

php
use Jaybizzle\CrawlerDetect\CrawlerDetect;

public function index(CrawlerDetect $crawlerDetect)
{
    if ($crawlerDetect->isCrawler()) {
        // ...
    }
}

Or use the Request macros, which detect using the current request:

php
use Illuminate\Http\Request;

public function index(Request $request)
{
    if ($request->isCrawler()) {
        // Output the name of the bot that matched (if any)
        echo $request->crawler()->getMatches();
    }

    // Or pass a user agent string to check
    if ($request->isCrawler('Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)')) {
        // ...
    }
}

Testing

bash
composer test

License

Laravel Crawler Detect is open-sourced software licensed under the MIT license.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPbotcrawlerdetectlaravel

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架