PHPackages                             fill84/laravel-firewall - 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. [Admin Panels](/categories/admin)
4. /
5. fill84/laravel-firewall

ActiveLibrary[Admin Panels](/categories/admin)

fill84/laravel-firewall
=======================

A comprehensive firewall middleware for Laravel applications with modern Tailwind CSS admin interface that monitors and blocks suspicious activity

v2.0.0(6mo ago)03MITBladePHP ^8.1

Since Oct 31Pushed 6mo agoCompare

[ Source](https://github.com/Fill84/Laravel-Firewall)[ Packagist](https://packagist.org/packages/fill84/laravel-firewall)[ RSS](/packages/fill84-laravel-firewall/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Laravel Firewall Package
========================

[](#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
--------

[](#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
------------

[](#installation)

Install the package via Composer:

```
composer require fill84/laravel-firewall
```

### Laravel 11+ (Auto-Discovery)

[](#laravel-11-auto-discovery)

The package will automatically register itself via Laravel's package auto-discovery feature.

### Laravel 10 or Manual Registration

[](#laravel-10-or-manual-registration)

Add the service provider to your `config/app.php`:

```
'providers' => [
    // Other providers...
    Fill84\LaravelFirewall\FirewallServiceProvider::class,
];
```

Configuration
-------------

[](#configuration)

Publish the configuration file:

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

This will create a `config/firewall.php` file where you can customize the package settings:

```
return [
    'suspicious_paths' => [
        'wp-admin.php',
        'wp-login.php',
        'phpinfo.php',
        // Add your own patterns...
    ],
    'max_attempts' => 3,
    'whitelist_ips' => [
        '127.0.0.1',
        // Add your trusted IPs...
    ],
    // More configuration options...
];
```

Database Setup
--------------

[](#database-setup)

Publish and run the migrations:

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

This will create two tables:

- `firewall_logs` - Stores all firewall events and request details
- `firewall_blocks` - Manages blocked IP addresses

Usage
-----

[](#usage)

### 1. Register the Middleware

[](#1-register-the-middleware)

Add the firewall middleware to your application. You can do this globally or on specific routes.

#### Global Protection (Recommended)

[](#global-protection-recommended)

Add to `app/Http/Kernel.php`:

```
protected $middleware = [
    // Other middleware...
    \Fill84\LaravelFirewall\Http\Middleware\Firewall::class,
];
```

#### Route-Specific Protection

[](#route-specific-protection)

```
Route::group(['middleware' => 'firewall'], function () {
    // Your protected routes...
});
```

#### Controller Protection

[](#controller-protection)

```
class YourController extends Controller
{
    public function __construct()
    {
        $this->middleware('firewall');
    }
}
```

### 2. Admin Interface (Optional)

[](#2-admin-interface-optional)

Publish the views to customize the admin interface:

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

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`:

```
use Fill84\LaravelFirewall\Http\Controllers\FirewallController;

Route::prefix('admin/firewall')->middleware(['auth', 'admin'])->group(function () {
    Route::get('logs', [FirewallController::class, 'logs'])->name('admin.firewall.logs');
    Route::get('logs/{id}', [FirewallController::class, 'logDetail'])->name('admin.firewall.logs.detail');
    Route::get('blocked', [FirewallController::class, 'blocked'])->name('admin.firewall.blocked');
    Route::get('stats', [FirewallController::class, 'stats'])->name('admin.firewall.stats');
    Route::post('unblock/{ip}', [FirewallController::class, 'unblock'])->name('admin.firewall.unblock');
    Route::post('block', [FirewallController::class, 'block'])->name('admin.firewall.block');
    Route::delete('cleanup', [FirewallController::class, 'cleanupLogs'])->name('admin.firewall.cleanup');
});
```

**Option 2: Publish Routes File**

Alternatively, publish the routes file and load it automatically:

```
php artisan vendor:publish --tag=firewall-routes
```

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.php` file. You can also copy the example routes from `vendor/fill84/laravel-firewall/routes/web.php`.

#### Admin Interface Features:

[](#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:

[](#styling-requirements)

The admin interface requires **Tailwind CSS**. If your Laravel application doesn't have Tailwind CSS installed:

```
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
```

Add to your `tailwind.config.js`:

```
module.exports = {
  content: [
    './resources/**/*.blade.php',
    './vendor/fill84/laravel-firewall/resources/views/**/*.blade.php',
  ],
  // ... rest of your config
}
```

Configuration Options
---------------------

[](#configuration-options)

### Suspicious Paths

[](#suspicious-paths)

Define patterns that should be monitored:

```
'suspicious_paths' => [
    'wp-admin.php',        // Exact match
    'wp-login.php',        // Exact match
    '*admin*',             // Contains 'admin'
    'config*.php',         // Starts with 'config', ends with '.php'
    '*.env',               // Any .env file
],
```

### Maximum Attempts

[](#maximum-attempts)

Set how many suspicious requests trigger a block:

```
'max_attempts' => 3, // Block after 3 attempts in 24 hours
```

### IP Whitelisting

[](#ip-whitelisting)

Protect trusted IPs from being blocked:

```
'whitelist_ips' => [
    '127.0.0.1',
    '192.168.1.100',
    '::1',
],
```

### Detailed Logging

[](#detailed-logging)

Control what information is logged:

```
'log_detailed_info' => true, // Log headers, POST data, etc.
```

Environment Variables
---------------------

[](#environment-variables)

You can also configure the package using environment variables:

```
FIREWALL_MAX_ATTEMPTS=5
FIREWALL_BLOCK_DURATION=1440  # minutes (null for permanent)
FIREWALL_LOG_DETAILED=true
FIREWALL_GEO_LOGGING=false
```

Manual IP Management
--------------------

[](#manual-ip-management)

### Block an IP Programmatically

[](#block-an-ip-programmatically)

```
use Illuminate\Support\Facades\DB;

DB::table('firewall_blocks')->updateOrInsert(
    ['ip_address' => '192.168.1.100'],
    [
        'is_blocked' => true,
        'blocked_at' => now(),
        'admin_notes' => 'Manually blocked for suspicious activity',
        'updated_at' => now(),
    ]
);
```

### Unblock an IP Programmatically

[](#unblock-an-ip-programmatically)

```
use Illuminate\Support\Facades\DB;

DB::table('firewall_blocks')
    ->where('ip_address', '192.168.1.100')
    ->update([
        'is_blocked' => false,
        'unblocked_at' => now(),
    ]);
```

Database Maintenance
--------------------

[](#database-maintenance)

### Clean Up Old Logs

[](#clean-up-old-logs)

```
# Delete logs older than 30 days
php artisan tinker
> DB::table('firewall_logs')->where('created_at', ' true,
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Support
-------

[](#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.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance67

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

191d ago

Major Versions

v1.0.0 → v2.0.02025-10-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a53d446fe172ab3f34c4109c2380626e37170b0d463afd05abf2821e34e281f?d=identicon)[Fill84](/maintainers/Fill84)

---

Top Contributors

[![Fill84](https://avatars.githubusercontent.com/u/6890678?v=4)](https://github.com/Fill84 "Fill84 (3 commits)")

---

Tags

middlewarelaravelsecuritydashboardstatisticsfirewallprotectionip-blockingAdmin Interfacetailwind css

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fill84-laravel-firewall/health.svg)

```
[![Health](https://phpackages.com/badges/fill84-laravel-firewall/health.svg)](https://phpackages.com/packages/fill84-laravel-firewall)
```

###  Alternatives

[andreaselia/analytics

Analytics for the Laravel framework.

19719.5k2](/packages/andreaselia-analytics)[eliseekn/laravel-metrics

Generate easily metrics and trends data of your models for your dashboards.

1075.7k](/packages/eliseekn-laravel-metrics)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2011.0k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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