PHPackages                             keepsuit/laravel-threat-blocker - 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. keepsuit/laravel-threat-blocker

ActiveLibrary[Security](/categories/security)

keepsuit/laravel-threat-blocker
===============================

Block threat request to your application

0.1.2(3mo ago)01.1k↓44.6%[2 PRs](https://github.com/keepsuit/laravel-threat-blocker/pulls)MITPHPPHP ^8.3CI passing

Since Nov 20Pushed 1w agoCompare

[ Source](https://github.com/keepsuit/laravel-threat-blocker)[ Packagist](https://packagist.org/packages/keepsuit/laravel-threat-blocker)[ Docs](https://github.com/keepsuit/laravel-threat-blocker)[ RSS](/packages/keepsuit-laravel-threat-blocker/feed)WikiDiscussions main Synced yesterday

READMEChangelog (3)Dependencies (32)Versions (8)Used By (0)

Block threat request to your application
========================================

[](#block-threat-request-to-your-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/43d5e1bdcabcd59c9e5f296d561165d23c7e8e0364857eecb91ff069c8a4334d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b656570737569742f6c61726176656c2d7468726561742d626c6f636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/keepsuit/laravel-threat-blocker)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f3067a24d34ab1fccfdb1bc04e01e52be0006454d2b958371b32d021f5e420ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b656570737569742f6c61726176656c2d7468726561742d626c6f636b65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/keepsuit/laravel-threat-blocker/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/850f190b3d61898f0a73e493c40b76215a05c63ae1ee7c97ae73f279e0669380/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b656570737569742f6c61726176656c2d7468726561742d626c6f636b65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/keepsuit/laravel-threat-blocker/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/64e0aa327df6f58403eefa03dd7610311016fc90657212bb97eba3a1d42d42cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b656570737569742f6c61726176656c2d7468726561742d626c6f636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/keepsuit/laravel-threat-blocker)

Laravel Threat Blocker is a package to block threat requests to your Laravel application based on different rules.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require keepsuit/laravel-threat-blocker
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-threat-blocker-config"
```

This is the contents of the published config file:

```
return [
    /**
     * This option enables or disables the Threat Blocker protection.
     */
    'enabled' => env('THREAT_BLOCKER_ENABLED', true),

    /**
     * Storage driver to use for caching detectors data.
     */
    'storage_driver' => env('THREAT_BLOCKER_STORAGE_DRIVER', 'cache'),

    'storage' => [
        'cache' => [
            'store' => env('THREAT_BLOCKER_CACHE_STORE', env('CACHE_STORE', 'file')),
            'prefix' => env('THREAT_BLOCKER_CACHE_PREFIX', 'threat_blocker'),
        ],
    ],

    /**
     * The following list of "detectors" will be used to identify threats.
     * You can enable or disable each detector individually and configure their settings.
     */
    'detectors' => [
        /**
         * Block requests coming from IPs listed in the AbuseIPDB database.
         */
        \Keepsuit\ThreatBlocker\Detectors\AbuseIpDetector::class => [
            'enabled' => env('THREAT_BLOCKER_ABUSE_IP_DETECTOR_ENABLED', true),
            // Source url for AbuseIP data, it can be a custom url or one of the predefined sources (provided by https://github.com/borestad/blocklist-abuseipdb)
            'source' => \Keepsuit\ThreatBlocker\Enums\AbuseIpSource::Days30->url(),
            'blacklist' => [
                // These IPs will always be blocked by the AbuseIpDetector
            ],
            'whitelist' => [
                // These IPs will never be blocked by the AbuseIpDetector
                '127.0.0.1',
            ],
        ],
        /**
         * Block requests that contain form submissions with honeypot fields filled out.
         * This detector requires spatie/laravel-honeypot package to be installed and configured.
         */
        \Keepsuit\ThreatBlocker\Detectors\FormHoneypotDetector::class => [
            'enabled' => env('THREAT_BLOCKER_FORM_HONEYPOT_DETECTOR_ENABLED', true),
        ],
    ],
];
```

Usage
-----

[](#usage)

1. Add the `ProtectAgainstThreats` middleware to routes you want to protect:

    ```
    use Keepsuit\ThreatBlocker\Middleware\ProtectAgainstThreats;

    Route::post('contact', [ContactController::class, 'submit'])->middleware(ProtectAgainstThreats::class);
    ```
2. Run the update command to warm the detectors cache:

    ```
    php artisan threat-blocker:update
    ```
3. Schedule the update command to run periodically (e.g., daily) using Laravel's task scheduling:

    ```
    $schedule->command('threat-blocker:update')->daily();
    ```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

Credits
-------

[](#credits)

- [Fabio Capucci](https://github.com/keepsuit)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance90

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.1% of commits — single point of failure

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 ~59 days

Total

3

Last Release

107d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4271608?v=4)[Fabio Capucci](/maintainers/cappuc)[@cappuc](https://github.com/cappuc)

---

Top Contributors

[![cappuc](https://avatars.githubusercontent.com/u/4271608?v=4)](https://github.com/cappuc "cappuc (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelkeepsuitlaravel-threat-blocker

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/keepsuit-laravel-threat-blocker/health.svg)

```
[![Health](https://phpackages.com/badges/keepsuit-laravel-threat-blocker/health.svg)](https://phpackages.com/packages/keepsuit-laravel-threat-blocker)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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