pratik-dabhi/laravel-firewall

A powerful and extensible firewall package for Laravel 10+ supporting IP blocking, CIDR rules, rate limiting, request logging, and country blocking.

Maintainers

Package info

github.com/pratik-dabhi/laravel-firewall

pkg:composer/pratik-dabhi/laravel-firewall

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v2.0.0 2026-03-29 09:01 UTC

README

A powerful, extensible, and developer-friendly application-level firewall for Laravel 10+.

This package gives your Laravel app real-time protection through:

  • 🔒 IP Blacklisting / Whitelisting
  • 🌐 CIDR Blocking
  • 🚫 Rate Limiting Rule Engine
  • 📄 Database Logging of Security Events
  • 📊 Beautiful Firewall Dashboard UI
  • 📜 Detailed Logs Viewer Page
  • 🧱 Plug-and-play Middleware
  • ✔ Fully tested using Laravel Testbench

It brings enterprise-level request filtering & monitoring into your Laravel application with minimal configuration.

Installation

composer require pratik-dabhi/laravel-firewall

Publishing

Migrations

php artisan vendor:publish --tag="firewall-migrations"
php artisan migrate

Config

php artisan vendor:publish --tag="firewall-config"

Views

php artisan vendor:publish --tag="firewall-views"

Usage

Register middleware in Laravel 12 (bootstrap/app.php):

->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'firewall' => \PratikDabhi\Firewall\Middleware\Firewall::class,
    ]);
})

Protect routes:

Route::middleware(['firewall'])->group(function () {
    Route::get('/', fn() => 'Protected Page');
});

Dashboard routes:

Route::get('/firewall/dashboard', fn() => view('vendor.firewall.dashboard'));
Route::get('/firewall/logs', fn() => view('vendor.firewall.logs'));

Testing

composer test

Credits

  • Pratik Dabhi
  • All Contributors

License

MIT License.