Download the PHP package fill84/laravel-firewall without Composer
On this page you can find all versions of the php package fill84/laravel-firewall. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fill84/laravel-firewall
More information about fill84/laravel-firewall
Files in fill84/laravel-firewall
Package laravel-firewall
Short Description A comprehensive firewall middleware for Laravel applications with modern Tailwind CSS admin interface that monitors and blocks suspicious activity
License MIT
Informations about the package laravel-firewall
Laravel Firewall Package
A comprehensive firewall middleware for Laravel applications that monitors and blocks suspicious activity, protecting your application from malicious requests and automated attacks.
Features
- 🛡️ Real-time Protection: Automatically detects and blocks suspicious requests
- 📊 Comprehensive Logging: Detailed logs of all firewall events with request information
- 🎯 Pattern Matching: Configurable suspicious path patterns with wildcard support
- 🔧 Admin Interface: Web interface for managing blocked IPs and viewing logs
- ⚙️ Configurable: Highly customizable settings via configuration file
- 🏠 IP Whitelisting: Protect trusted IPs from being blocked
- 📈 Statistics: Detailed statistics and reporting
- 🌍 Geo-location: Optional geographical logging of blocked IPs
Installation
Install the package via Composer:
Laravel 11+ (Auto-Discovery)
The package will automatically register itself via Laravel's package auto-discovery feature.
Laravel 10 or Manual Registration
Add the service provider to your config/app.php:
Configuration
Publish the configuration file:
This will create a config/firewall.php file where you can customize the package settings:
Database Setup
Publish and run the migrations:
This will create two tables:
firewall_logs- Stores all firewall events and request detailsfirewall_blocks- Manages blocked IP addresses
Usage
1. Register the Middleware
Add the firewall middleware to your application. You can do this globally or on specific routes.
Global Protection (Recommended)
Add to app/Http/Kernel.php:
Route-Specific Protection
Controller Protection
2. Admin Interface (Optional)
Publish the views to customize the admin interface:
The admin interface is built with Tailwind CSS for modern, responsive design. Make sure your Laravel application has Tailwind CSS configured.
Option 1: Manual Route Registration
Add routes to your routes/web.php:
Option 2: Publish Routes File
Alternatively, publish the routes file and load it automatically:
This creates routes/firewall-admin.php which will be automatically loaded by the package.
⚠️ Important: If you get a "Route not defined" error, make sure you have added the routes above to your application's
routes/web.phpfile. You can also copy the example routes fromvendor/fill84/laravel-firewall/routes/web.php.
Admin Interface Features:
- 📊 Logs Dashboard (
/admin/firewall/logs) - View and filter all firewall events - 🚫 Blocked IPs Management (
/admin/firewall/blocked) - Manage blocked IP addresses - 📈 Statistics Overview (
/admin/firewall/stats) - Security metrics and top attackers - 🔍 Detailed Log View (
/admin/firewall/logs/{id}) - In-depth analysis of individual events - 🎨 Modern UI - Built with Tailwind CSS for responsive, professional design
Styling Requirements:
The admin interface requires Tailwind CSS. If your Laravel application doesn't have Tailwind CSS installed:
Add to your tailwind.config.js:
Configuration Options
Suspicious Paths
Define patterns that should be monitored:
Maximum Attempts
Set how many suspicious requests trigger a block:
IP Whitelisting
Protect trusted IPs from being blocked:
Detailed Logging
Control what information is logged:
Environment Variables
You can also configure the package using environment variables:
Manual IP Management
Block an IP Programmatically
Unblock an IP Programmatically
Database Maintenance
Clean Up Old Logs
Monitor Database Size
The firewall logs can grow large over time. Consider:
- Regular cleanup of old logs
- Database indexing for performance
- Log rotation strategies
Performance Considerations
- The middleware adds minimal overhead (< 5ms typically)
- Database queries are optimized with proper indexing
- Consider caching for high-traffic applications
- Monitor log table size and clean up regularly
Security Notes
- Always keep your whitelist IPs updated
- Regularly review blocked IPs for false positives
- Monitor firewall logs for new attack patterns
- Consider rate limiting in addition to this firewall
Troubleshooting
Common Issues
-
Route [admin.firewall.logs.detail] not defined
- Solution: Make sure you have added all the admin routes to your
routes/web.phpfile - Copy the routes from the installation section above or from
vendor/fill84/laravel-firewall/routes/web.php
- Solution: Make sure you have added all the admin routes to your
- Middleware not working: Ensure it's properly registered in
Kernel.php - Database errors: Run migrations with
php artisan migrate - High false positives: Adjust
suspicious_pathsconfiguration - Performance issues: Clean up old logs and optimize database
- Tailwind CSS not working: Ensure Tailwind is properly installed and configured
Debug Mode
Enable detailed logging in your configuration:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT license.
Support
If you encounter any issues or have questions, please create an issue on GitHub.
Note: Replace fill84/laravel-firewall and Fill84 with your actual package name and namespace if you fork this project.
All versions of laravel-firewall with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0