PHPackages                             potelo/laravel-block-bots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. potelo/laravel-block-bots

ActiveLibrary[Security](/categories/security)

potelo/laravel-block-bots
=========================

Block bots and high traffic offenders using Redis

3.0(6mo ago)5416.0k↓42.6%18[1 issues](https://github.com/Potelo/laravel-block-bots/issues)[1 PRs](https://github.com/Potelo/laravel-block-bots/pulls)PHPPHP ^7.1 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4CI failing

Since Sep 5Pushed 6mo ago3 watchersCompare

[ Source](https://github.com/Potelo/laravel-block-bots)[ Packagist](https://packagist.org/packages/potelo/laravel-block-bots)[ RSS](/packages/potelo-laravel-block-bots/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (5)Versions (34)Used By (0)

Laravel Block Bots
==================

[](#laravel-block-bots)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0fc332483b522f4d1604f9c7b67ac8badc9f986a2b3a86f974cf2958a371258e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f74656c6f2f6c61726176656c2d626c6f636b2d626f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/potelo/laravel-block-bots)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/bda10117d946eb028666d60e6af28a668861938e538e31ded6a2f9d519d2efa8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706f74656c6f2f6c61726176656c2d626c6f636b2d626f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/potelo/laravel-block-bots)

Introduction
------------

[](#introduction)

Laravel Block bots is a package that blocks bad crawlers, people trying to scrape your website or high-usage users, but lets good and important crawlers such as GoogleBot and Bing pass through.

Features
--------

[](#features)

- ULTRA fast, less than 1ms increase in each request.
- Verify Crawlers using reverse DNS
- Highly configurable
- Redirect users to a page when they got blocked
- Allow Logged users to always bypass blocks
- **Native IPv6 support** with prefix-based rate limiting

Install
-------

[](#install)

Via Composer

```
composer require potelo/laravel-block-bots
```

#### Requirement

[](#requirement)

- This package relies heavily on Redis. To use it, make sure that Redis is configured and ready. (see [Laravel Redis Configuration](https://laravel.com/docs/5.6/redis#configuration))

#### Before Laravel 5.5

[](#before-laravel-55)

In Laravel 5.4, you'll manually need to register the `\Potelo\LaravelBlockBots\BlockBots::class` service provider in `config/app.php`.

#### Config

[](#config)

To adjust the library, you can publish the config file to your project using:

```
php artisan vendor:publish --provider="Potelo\LaravelBlockBots\BlockBotsServiceProvider"

```

Configure variables in your .env file:

```
BLOCK_BOTS_ENABLED=true                     # Enables block bots
BLOCK_BOTS_MODE=production                  # Options: production, never, always
BLOCK_BOTS_USE_DEFAULT_ALLOWED_BOTS=true    # Use our preset whitelist
BLOCK_BOTS_WHITELIST_KEY=block_bot:whitelist
BLOCK_BOTS_FAKE_BOTS_KEY=block_bot:fake_bots
BLOCK_BOTS_PENDING_BOTS_KEY=block_bot:pending_bots
BLOCK_BOTS_LOG_ENABLED=true                 # Enables log
BLOCK_BOTS_IPV6_PREFIX_LENGTH=64            # IPv6 prefix length (see below)

```

Usage
-----

[](#usage)

It's simple. Go to `Kernel.php` and add to the `$routeMiddleware` block as:

```
protected $routeMiddleware = [
    // ...
    'block' => \Potelo\LaravelBlockBots\Middleware\BlockBots::class,
];
```

Then you can put it in the desired groups. For example, let's set it to the web group:

```
protected $middlewareGroups = [
    'web' => [
        // ...
        \App\Http\Middleware\VerifyCsrfToken::class,
        'block:100,daily', // 100 requests per day.
    ],
];
```

Where:

- **100**: is the number of pages an IP can access every day
- **daily**: is the time period. Options: `hourly`, `daily`, `weekly`, `monthly`, `annually`

IPv6 Support
------------

[](#ipv6-support)

This package has native IPv6 support with **prefix-based rate limiting**.

### Why Prefix-Based Rate Limiting?

[](#why-prefix-based-rate-limiting)

IPv6 users typically receive a prefix (e.g., /64) from their ISP, giving them access to millions or trillions of unique IP addresses. Without prefix-based handling, a malicious user could easily bypass rate limits by rotating through different IPs within their allocation.

This package normalizes IPv6 addresses to their prefix for tracking:

```
2001:db8:1234:5678:aaaa:bbbb:cccc:dddd → 2001:db8:1234:5678::

```

All IPs within the same prefix are treated as a single entity for rate limiting.

### Configuring IPv6 Prefix Length

[](#configuring-ipv6-prefix-length)

Set the prefix length in your `.env`:

```
BLOCK_BOTS_IPV6_PREFIX_LENGTH=64

```

PrefixUse CaseDescription/64Standard residential (default)Most common allocation, recommended for most cases/56Some residential ISPsIf your users typically have /56 allocations/48Business/enterpriseFor sites primarily serving business networks### Bot Verification with IPv6

[](#bot-verification-with-ipv6)

The package also handles legitimate bots (like GoogleBot) that use IPv6:

- Original IP is used for reverse DNS verification
- Trackable prefix is used for whitelisting
- Once verified, all IPs within the bot's prefix are automatically allowed

This ensures legitimate crawlers are never blocked while still rate limiting potential abusers.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Credits
-------

[](#credits)

- [Potelo](https://github.com/potelo)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance68

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~83 days

Recently: every ~61 days

Total

33

Last Release

186d ago

Major Versions

0.2.2 → 1.0.02020-05-08

1.6.1 → 2.0.02025-04-29

2.1.2 → 3.02025-12-29

PHP version history (4 changes)0.1.0PHP ^7.0

1.4.0PHP ^7.1 || ^8.0

1.6.0PHP ^7.1 || ^8.0 || ^8.1 || ^8.2

2.1.0PHP ^7.1 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffd057699c6f31586d7883c4f8a903048c26a1c3ccef618caf02738ddfd254ee?d=identicon)[potelo](/maintainers/potelo)

---

Top Contributors

[![gabrielpeixoto](https://avatars.githubusercontent.com/u/3699061?v=4)](https://github.com/gabrielpeixoto "gabrielpeixoto (31 commits)")[![andrewalkermo](https://avatars.githubusercontent.com/u/20683045?v=4)](https://github.com/andrewalkermo "andrewalkermo (17 commits)")[![jprodrigues70](https://avatars.githubusercontent.com/u/9157395?v=4)](https://github.com/jprodrigues70 "jprodrigues70 (14 commits)")[![bratao](https://avatars.githubusercontent.com/u/1090152?v=4)](https://github.com/bratao "bratao (6 commits)")[![tsekka](https://avatars.githubusercontent.com/u/43533692?v=4)](https://github.com/tsekka "tsekka (4 commits)")[![dungnh](https://avatars.githubusercontent.com/u/1852709?v=4)](https://github.com/dungnh "dungnh (4 commits)")[![amoktar](https://avatars.githubusercontent.com/u/6639392?v=4)](https://github.com/amoktar "amoktar (4 commits)")[![marivaldojr](https://avatars.githubusercontent.com/u/2505142?v=4)](https://github.com/marivaldojr "marivaldojr (4 commits)")[![davidmuggleton](https://avatars.githubusercontent.com/u/15907082?v=4)](https://github.com/davidmuggleton "davidmuggleton (1 commits)")

---

Tags

botscrawlerslaravelscrapper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/potelo-laravel-block-bots/health.svg)

```
[![Health](https://phpackages.com/badges/potelo-laravel-block-bots/health.svg)](https://phpackages.com/packages/potelo-laravel-block-bots)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.4k](/packages/unopim-unopim)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k172.1k9](/packages/bagisto-bagisto)[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.7M222](/packages/backpack-crud)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[lion/bundle

Lion-framework configuration and initialization package

122.3k4](/packages/lion-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
