Looking to hire Laravel developers? Try LaraJobs

laravel-firewall maintained by pratik-dabhi

Description
A powerful and extensible firewall package for Laravel 10+ supporting IP blocking, CIDR rules, rate limiting, request logging, and country blocking.
Author
Last update
2026/03/29 11:01 (dev-master)
License
Links
Downloads
1

Comments
comments powered by Disqus

Laravel Firewall

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.