Download the PHP package setono/bot-detection-bundle without Composer
On this page you can find all versions of the php package setono/bot-detection-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download setono/bot-detection-bundle
More information about setono/bot-detection-bundle
Files in setono/bot-detection-bundle
Package bot-detection-bundle
Short Description A Symfony bundle that allows you to test if a user agent is a bot
License MIT
Informations about the package bot-detection-bundle
Symfony Bot Detection Bundle
Detect if the user agent is a bot and act upon it. The detection is based on the bot list from matomo-org/device-detector, which is compiled into a single regular expression and updated weekly.
Before the full bot list is used, the user agent is checked against a short list of the most active crawlers (search engines, AI crawlers, SEO tools and social media fetchers). This makes it much faster to detect the most common bots and hence speeds up your request cycle.
Requirements
- PHP 8.1 or higher
- Symfony 6.4, 7.4 or 8
Installation
If you use Symfony Flex, the bundle is enabled automatically. Otherwise, add it to config/bundles.php:
Usage
In your services
Inject BotDetectorInterface:
isBotRequest() also accepts a Request object. It returns false if there is no request or the request has no
User-Agent header.
In Twig templates
Configuration
The list of the most active crawlers is the setono_bot_detection.popular_bots parameter. You can override it in
config/services.yaml, e.g. to put the bots that visit your site the most first:
Each entry is a regular expression that is matched case-insensitively against the user agent. A user agent that matches an entry is treated as a bot, so keep the entries specific. A user agent that doesn't match any of them is still checked against the full bot list.
All versions of bot-detection-bundle with dependencies
symfony/config Version ^6.4 || ^7.4 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.4 || ^8.0
symfony/http-foundation Version ^6.4 || ^7.4 || ^8.0
symfony/http-kernel Version ^6.4 || ^7.4 || ^8.0
twig/twig Version ^2.14 || ^3.4