PHPackages                             uhowep/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. [Security](/categories/security)
4. /
5. uhowep/firewall

ActiveLibrary[Security](/categories/security)

uhowep/firewall
===============

A Simple Firewall For Laravel

17PHP

Since Apr 9Pushed 8y agoCompare

[ Source](https://github.com/uhowep/firewall)[ Packagist](https://packagist.org/packages/uhowep/firewall)[ RSS](/packages/uhowep-firewall/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

firewall
========

[](#firewall)

A simple anti-irrigation water filtration detection and monitoring for Laravel

---

应用于Laravel中的简单的防灌水过滤检测

- 支持以用户、IP地址、主机等等作为检测对象
- 支持定义接口组，以接口组为单位进行单独的配置
- 配置的过滤机制包含每天访问的总次数、每次访问的时间间隔、以及访问的频率

---

### Install

[](#install)

composer it

```
composer require uhowep/firewall:dev-master

```

Then run these commands to publish config：

```
php artisan vendor:publish --provider="Uhowep\Firewall\FirewallServiceProvider"

```

### Config

[](#config)

在`config/firewall.php`文件中配置`interface_group`，该数组中的每个key为接口组的名称，所有的检测配置基于该接口组，其下有`interface`、`interval`、`limit`及`frequency`字段。

- `interface`为该接口组中的接口列表，可配置为路由uri
- `limit`为总次数(当天，目前只支持到按天)
- `interval`为访问的时间间隔(秒)
- `frequency`为访问的频率(次/分钟)，其下有minutes及times两个字段，代表minutes分钟内times次

**注：frequency中1分钟10次和2分钟20次不是同一个概念**

### Usage

[](#usage)

常用于路由中：

```
...
use Uhowep\Firewall\Firewall;

...
$sign = 'sign';		// 此处可以用登录用户的主键，也可以用来源的IP地址
$interface = Route::current()->uri;		// 获取当前访问路径的uri
$firewallObj = new Firewall;
$isPass = $firewallObj->authorize($sign, $interface);		// 通过与否的结果

```

注意：

- `sign`用以标识要进行检测的用户/IP等等，若为空则直接通行
- `interface`将与config中的interface接口列表进行匹配，若出现在列表里则进行检测，否则直接通行
- 检测时，以接口组为单位，以接口组为单位，以接口组为单位，不以接口为单位！

### Drawback

[](#drawback)

- `暂不支持同一接口出现在不同的接口组中`
- 可优化增加驱动支持

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/054abb4fd7d8485f8e5edabc4af792764b26b69d56ade0c1e39a8bdf7b226bc7?d=identicon)[uhowep](/maintainers/uhowep)

---

Top Contributors

[![uhowep](https://avatars.githubusercontent.com/u/24932775?v=4)](https://github.com/uhowep "uhowep (10 commits)")

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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