PHPackages                             dabashan/bt-thinkphp-waf - 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. dabashan/bt-thinkphp-waf

ActiveLibrary[Security](/categories/security)

dabashan/bt-thinkphp-waf
========================

大巴山宝塔WAF - ThinkPHP防护中间件

00PHP

Since Mar 28Pushed 1mo agoCompare

[ Source](https://github.com/dabashannet/thinkphp-waf)[ Packagist](https://packagist.org/packages/dabashan/bt-thinkphp-waf)[ RSS](/packages/dabashan-bt-thinkphp-waf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

dabashan/bt-thinkphp-waf
========================

[](#dabashanbt-thinkphp-waf)

大巴山宝塔WAF - ThinkPHP 防护中间件

简介
--

[](#简介)

本包为 [大巴山宝塔WAF](https://www.dabashan.cc) 提供 ThinkPHP 框架集成支持，兼容 TP5.x 和 TP6.x。

核心功能：

- **CC 防护**：基于文件计数器的速率限制（无需 Redis/Memcached）
- **URL 规则检测**：SQL 注入、路径穿越、敏感文件访问
- **ThinkPHP 专项规则**：针对 ThinkPHP CVE 漏洞的专项检测
- **POST 检测**：请求体恶意内容检测
- **UA 检测**：恶意爬虫和扫描器识别
- **运营监控**：慢请求统计、错误日志、流量趋势

安装
--

[](#安装)

```
composer require dabashan/bt-thinkphp-waf
```

配置
--

[](#配置)

将 `config/dbswaf.php` 复制到您的 ThinkPHP 项目配置目录：

```
# TP6
cp vendor/dabashan/bt-thinkphp-waf/config/dbswaf.php config/dbswaf.php

# TP5
cp vendor/dabashan/bt-thinkphp-waf/config/dbswaf.php application/extra/dbswaf.php
```

注册中间件
-----

[](#注册中间件)

**ThinkPHP 6.x**（`app/middleware.php`）：

```
