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

ActiveLibrary

ilbsfx/captcha
==============

tp验证码独立版本

v1.0(4y ago)017PHP

Since Jun 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Colton-x/captcha)[ Packagist](https://packagist.org/packages/ilbsfx/captcha)[ RSS](/packages/ilbsfx-captcha/feed)WikiDiscussions main Synced 5d ago

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

captcha
=======

[](#captcha)

tp验证码独立版

安装
--

[](#安装)

composer require ilbsfx/captcha

配置参数（可选）
--------

[](#配置参数可选)

参数描述默认codeSet验证码字符集合略math使用算术验证码falseuseZh使用中文验证码falsezhSet中文验证码字符串略useImgBg使用背景图片falsefontSize验证码字体大小(px)25useCurve是否画混淆曲线trueuseNoise是否添加杂点trueimageH验证码图片高度，设置为0为自动计算0imageW验证码图片宽度，设置为0为自动计算0length验证码位数5fontttf验证码字体，不设置是随机获取空bg背景颜色\[243, 251, 254\]使用
--

[](#使用)

```
use Colton\Captcha\CaptchaBuilder;

//（可选参数）
$config = [
    //验证码位数
    'length'   => 5,
    // 验证码字符集合
    'codeSet'  => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
    // 是否使用中文验证码
    'useZh'    => false,
    // 是否使用算术验证码
    'math'     => false,
    // 是否使用背景图
    'useImgBg' => false,
    //验证码字符大小
    'fontSize' => 25,
    // 是否使用混淆曲线
    'useCurve' => true,
    //是否添加杂点
    'useNoise' => true,
    // 验证码字体 不设置则随机
    'fontttf'  => '',
    //背景颜色
    'bg'       => [243, 251, 254],
    // 验证码图片高度
    'imageH'   => 0,
    // 验证码图片宽度
    'imageW'   => 0
];

$captcha = new CaptchaBuilder($config);

// 获取验证码key
$_SESSION['key'] = $captcha->getCodeKey();

// 输出验证码图片
$captcha->output();

// 验证验证码是否正确
$userInput = $_POST['code'];
$res = $captcha->check($userInput, $_SESSION['key']);
if ($res === true) {
    // 验证码正确
} else {
    // 验证码错误
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

1803d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/532cad4859ec6c70e0c52b97db7f385825ab45ac7b99e6b52a713d4c2da08775?d=identicon)[image677](/maintainers/image677)

---

Top Contributors

[![Colton-x](https://avatars.githubusercontent.com/u/22774104?v=4)](https://github.com/Colton-x "Colton-x (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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