CrawlerDetector
in package
FinalYes
Recognises automated clients by their User-Agent.
Used to keep crawlers from triggering actions (signals ?do=...: favourites, cart,
rating, report). They may read every content page; they must not click.
This is a courtesy filter for clients that identify themselves, not a security boundary — anything that writes to the database has its own guard.
Table of Contents
Constants
- PATTERN : string = '~bot\b|bot[/;\s)]|crawl|spider|slurp|scrap|fet...
- Generic markers plus the names of crawlers that do not use them.
Methods
- isCrawler() : bool
- isCrawlerRequest() : bool
- View counters (list/detail) are written only for humans; crawlers would write to the DB on every request.
Constants
PATTERN
Generic markers plus the names of crawlers that do not use them.
private
string
PATTERN
= '~bot\b|bot[/;\s)]|crawl|spider|slurp|scrap|fetch|headless|preview|monitor|archiver|' . 'facebookexternalhit|bingpreview|mediapartners|google-inspectiontool|chatgpt-user|oai-searchbot|' . 'perplexity|bytespider|petalbot|ia_archiver|curl/|wget/|python-requests|go-http-client|okhttp|libwww~i'
Methods
isCrawler()
public
static isCrawler(string|null $userAgent) : bool
Parameters
- $userAgent : string|null
Return values
boolisCrawlerRequest()
View counters (list/detail) are written only for humans; crawlers would write to the DB on every request.
public
static isCrawlerRequest(IRequest $request) : bool
Parameters
- $request : IRequest