PHPackages                             tobycroft/think-captcha - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. tobycroft/think-captcha

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

tobycroft/think-captcha
=======================

thinkphp8+ captcha 2026 version PHP8.5+

v3.1.1(1mo ago)02↓90%MITPHP

Since Nov 22Pushed 1mo agoCompare

[ Source](https://github.com/tobycroft/think-captcha)[ Packagist](https://packagist.org/packages/tobycroft/think-captcha)[ RSS](/packages/tobycroft-think-captcha/feed)WikiDiscussions 3.0 Synced 1w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

think-captcha
=============

[](#think-captcha)

thinkphp8+ PHP8.5+ captcha验证码类库

区别
==

[](#区别)

- 支持 PHP8.5+
- 支持 thinkphp8+

安装
--

[](#安装)

> composer require tobycroft/think-captcha

使用
--

[](#使用)

#### 详细 Demo

[](#详细-demo)

- 你可以在 AOSSTP8这个项目中的 captcha 目录下查看详细的 Demo，涵盖了验证码的所有功能以及额外的骚操作

### 在控制器中输出验证码

[](#在控制器中输出验证码)

在控制器的操作方法中使用

```
public function captcha($id = '')
{
    return captcha($id);
}

```

然后注册对应的路由来输出验证码

### 模板里输出验证码

[](#模板里输出验证码)

首先要在你应用的路由定义文件中，注册一个验证码路由规则。

```
\think\facade\Route::get('captcha/[:id]', "\\tobycroft\\captcha\\CaptchaController@index");

```

然后就可以在模板文件中使用

```
{:captcha_img()}

```

或者

```

```

> 上面两种的最终效果是一样的

### 控制器里验证

[](#控制器里验证)

使用 TP 的内置验证功能即可

```
$this->validate($data,[
    'captcha|验证码'=>'require|captcha'
]);

```

或者手动验证

```
if(!captcha_check($captcha)){
 //验证失败
};

```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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 ~186 days

Total

4

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04f1f999374b5cfe445b20e876e6f22d89fa91bce2f421295cd43ba0f8095865?d=identicon)[tobycroft](/maintainers/tobycroft)

---

Top Contributors

[![liu21st](https://avatars.githubusercontent.com/u/1111670?v=4)](https://github.com/liu21st "liu21st (30 commits)")[![yunwuxin](https://avatars.githubusercontent.com/u/2168125?v=4)](https://github.com/yunwuxin "yunwuxin (14 commits)")[![tobycroft](https://avatars.githubusercontent.com/u/24893075?v=4)](https://github.com/tobycroft "tobycroft (3 commits)")[![ZayneSW](https://avatars.githubusercontent.com/u/16889839?v=4)](https://github.com/ZayneSW "ZayneSW (3 commits)")[![normal-coder](https://avatars.githubusercontent.com/u/6902432?v=4)](https://github.com/normal-coder "normal-coder (3 commits)")[![zhaishuaigan](https://avatars.githubusercontent.com/u/6310602?v=4)](https://github.com/zhaishuaigan "zhaishuaigan (1 commits)")[![lait233](https://avatars.githubusercontent.com/u/31282366?v=4)](https://github.com/lait233 "lait233 (1 commits)")[![tianheng2017](https://avatars.githubusercontent.com/u/29515610?v=4)](https://github.com/tianheng2017 "tianheng2017 (1 commits)")[![anydson](https://avatars.githubusercontent.com/u/15711052?v=4)](https://github.com/anydson "anydson (1 commits)")

### Embed Badge

![Health badge](/badges/tobycroft-think-captcha/health.svg)

```
[![Health](https://phpackages.com/badges/tobycroft-think-captcha/health.svg)](https://phpackages.com/packages/tobycroft-think-captcha)
```

###  Alternatives

[edward1108/edward-captcha

ThinkPHP6验证码(图片、短信)支持api友好化

158.0k](/packages/edward1108-edward-captcha)

PHPackages © 2026

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