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.
v2.0.0
2026-03-29 09:01 UTC
Requires
- php: ^8.2
- illuminate/cache: ^11.0 || ^12.0
- illuminate/config: ^11.0 || ^12.0
- illuminate/console: ^11.0 || ^12.0
- illuminate/database: ^11.0 || ^12.0
- illuminate/http: ^11.0 || ^12.0
- illuminate/routing: ^11.0 || ^12.0
- illuminate/support: ^11.0 || ^12.0
Requires (Dev)
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.3
This package is not auto-updated.
Last update: 2026-05-11 08:05:12 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.