setono/bot-detection-bundle

A Symfony bundle that allows you to test if a user agent is a bot

Installs: 5 068

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 4

Type:symfony-bundle

v1.6.0 2022-03-28 08:26 UTC

README

Latest Version Latest Unstable Version Software License Build Status Code Coverage Mutation testing

Installation

composer require setono/bot-detection-bundle

This installs and enables the plugin automatically if you're using Symfony Flex. If not, add the bundle manually to bundles.php.

Usage

<?php

use Setono\BotDetectionBundle\BotDetector\BotDetectorInterface;

final class YourService
{
    private BotDetectorInterface $botDetector;

    public function __construct(BotDetectorInterface $botDetector)
    {
        $this->botDetector = $botDetector;
    }

    public function yourAction(): void
    {
        if ($this->botDetector->isBotRequest()) {
            // do something to this bot!
        }

        // ...
    }
}