PHPackages                             time167/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. time167/think-captcha

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

time167/think-captcha
=====================

captcha package for thinkphp

1.0.0(6y ago)06Apache-2.0PHP

Since Sep 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/time167/think-captcha)[ Packagist](https://packagist.org/packages/time167/think-captcha)[ RSS](/packages/time167-think-captcha/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

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

[](#think-captcha)

thinkphp6 验证码类库

安装
--

[](#安装)

> composer require time167/think-captcha

使用
--

[](#使用)

> 类库默认为应用注册了一个验证码路由规则和验证规则，可查看CaptchaService.php

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

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

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

```
public function captcha()
{
	return captcha();
}

```

### 模板里输出验证码

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

在模板文件中使用

```
{:captcha_img()}

```

或者

```

```

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

### 控制器里验证

[](#控制器里验证)

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

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

```

或者手动验证

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

```

### 带参使用验证码，可自行查看源码

[](#带参使用验证码可自行查看源码)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

2419d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cda4e230e0803960eafaeb83c76058774af2a47fc39e35bea635d5ce24bbc83?d=identicon)[time167](/maintainers/time167)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)[edward1108/edward-captcha

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

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

PHPackages © 2026

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