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

ActiveLibrary

gitzwt/think-captcha-1.1
========================

thinkphp5.0 验证码类库,支持cache存储,方便api调用

v1.1(7y ago)181Apache-2.0PHP

Since Nov 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/gitzwt/think-captcha-1.1)[ Packagist](https://packagist.org/packages/gitzwt/think-captcha-1.1)[ RSS](/packages/gitzwt-think-captcha-11/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

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

[](#think-captcha-11)

thinkphp5.0 验证码类库(修改版)

> 修改部分,新增cache缓存存储验证码信息(便于api接口调用使用)

安装
--

[](#安装)

> composer require gitzwt/think-captcha-1.1

```
/**
     * 获取图片验证码(接口调用示例,type为cache时)
     * @return \think\response\Json
     */
    public function getCaptcha()
    {
        $captcha_id = Strs::randString(4, 1) . date('s'); //生成随机id
        //接口构建类的返回
        return $this->buildSuccess([
            'CaptchaId' => (String)$captcha_id, //captcha_id
            'CaptchaSrc' => $this->request->domain() . captcha_src($captcha_id) //验证码url
        ]);
    }

```

\##使用

#### extra子目录内配置 captcha.php

[](#extra子目录内配置-captchaphp)

参数描述默认codeSet验证码字符集合略expire验证码过期时间（s）1800useZh使用中文验证码falsezhSet中文验证码字符串略useImgBg使用背景图片falsefontSize验证码字体大小(px)25useCurve是否画混淆曲线trueuseNoise是否添加杂点trueimageH验证码图片高度，设置为0为自动计算0imageW验证码图片宽度，设置为0为自动计算0length验证码位数5fontttf验证码字体，不设置是随机获取空bg背景颜色\[243, 251, 254\]reset验证成功后是否重置truetype验证码存储驱动类型,支持session和cache默认cache\###模板里输出验证码

```
{:captcha_img()}

```

或者

```

```

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

### 控制器里验证

[](#控制器里验证)

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

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

```

或者手动验证

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

```

具体使用参照tp5.0完全开发手册验证码部分

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

2732d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ff417afdb58e98648d3558953551c732c55ae1669188a95cef5fc3124f692d0?d=identicon)[gitzwt](/maintainers/gitzwt)

---

Top Contributors

[![gitzwt](https://avatars.githubusercontent.com/u/16423694?v=4)](https://github.com/gitzwt "gitzwt (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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