Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Crawler Detect

Crawler Detect Laravel Package

jaybizzle/crawler-detect

CrawlerDetect is a PHP library for detecting bots, crawlers and spiders via User-Agent and HTTP_FROM headers, recognising thousands of agents. Call isCrawler() on the current request or any UA string, and getMatches() to see the bot name. Accepts PSR-7, Symfony, Swoole and Lambda headers.

View on GitHub
Deep Wiki
Context7

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

Frequently asked questions about Crawler Detect
How do I install jaybizzle/crawler-detect in a Laravel app?
Run composer require jaybizzle/crawler-detect and the library is ready to use immediately. There is no service provider, config file or migration to publish because the package is a single framework-agnostic PHP class. Most teams wrap it in a small service or middleware of their own so the detection seam stays explicit and swappable.
Does jaybizzle/crawler-detect support Laravel 11 and PHP 8?
The package has no Laravel coupling at all, so your Laravel version is not a constraint; only the PHP version constraint in composer.json matters. Recent releases dropped PHP 7.1 support and the CI runs against modern PHP versions including 8.5. If you are on Laravel 10, 11 or 12 with PHP 8.x you are well within supported territory.
How do I check whether the current visitor is a bot?
Instantiate CrawlerDetect with no arguments and call isCrawler(); it reads the User-Agent and HTTP_FROM values from $_SERVER. The method returns true when the header matches one of the thousands of known crawler signatures. You can also pass any user-agent string directly, which makes the same check usable for log analysis or queued jobs.
How do I get the name of the bot that matched?
Call getMatches() after a detection to retrieve the signature name that matched, for example Googlebot or bingbot. It returns null or an empty value when nothing matched, so guard the call behind isCrawler() or a null check. It is useful for logging, analytics and serving a crawler-specific response.
Does CrawlerDetect work with Laravel Octane or Swoole?
Yes, but you must pass headers in explicitly rather than relying on $_SERVER, which is unreliable in long-lived workers. The constructor accepts Swoole header arrays as well as PSR-7 getHeaders() output and Symfony HeaderBag instances. Both User-Agent and HTTP_USER_AGENT key names are understood, and values may be strings or arrays of strings.
Can I use it with PSR-7 requests or a Symfony HeaderBag?
Yes. Pass the request headers into the constructor, and CrawlerDetect will normalise the names and values for you. This covers Slim, Mezzio, Laminas, League, Symfony and any other PSR-7 implementation, plus Lambda event payloads. It is the recommended approach for anything that is not a classic PHP-FPM request.
Is CrawlerDetect reliable enough to block bots in production?
Treat it as classification, not verification: detection is based on header heuristics and cannot stop a client that spoofs or omits a User-Agent. False positives do occur and signatures are occasionally removed on patch releases when they match real browsers, so pinning versions and testing before upgrading is wise. For blocking decisions, combine it with rate limiting and verified-bot checks rather than relying on the User-Agent alone.
Can it verify Googlebot with IP or reverse DNS validation?
No. CrawlerDetect only inspects the User-Agent and HTTP_FROM headers, so anyone can present a Googlebot string and be matched. Confirming real Googlebot or bingbot traffic requires reverse DNS lookups and range checks against the search engines' published IP lists, which you must implement separately. The README itself notes that genuine Googlebot may sometimes send a browser user agent and identify itself through the From header instead.
Should I use the official Laravel-Crawler-Detect wrapper instead?
The JayBizzle/Laravel-Crawler-Detect wrapper adds a facade and a config file, which is convenient for quick prototypes. For most applications the core package plus a thin injected service is preferable, because it keeps the dependency a leaf node with no container conventions imposed on your code. Either way the underlying signature matching is identical.
Is jaybizzle/crawler-detect still maintained, and how do I test it?
It is actively maintained by a single primary maintainer with community pull requests, MIT licensed, with regular signature updates and CI running PHPStan and the test suite. Because it is a pure function of header strings, you can test your integration by passing fixed user-agent strings such as a known Googlebot UA and a normal browser UA into isCrawler(). Being small and auditable means forking is a realistic fallback if maintenance ever stalls.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo