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

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

minxinqing/captcha
==================

A captcha componet for hyperf .

2.0.1(2y ago)03MITPHPPHP &gt;=8.0

Since Oct 8Pushed 2y agoCompare

[ Source](https://github.com/minxinqing/captcha)[ Packagist](https://packagist.org/packages/minxinqing/captcha)[ RSS](/packages/minxinqing-captcha/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

**验证码组件**
---------

[](#验证码组件)

用于生产验证码，支持Hyperf框架，使用Composer安装,使用该组件需开启hyperf框架中的session组件

```
composer require lizhaoyang/captcha

```

**配置定义**
--------

[](#配置定义)

组件本身提供了默认配置，即使不做任何设置也可以直接生成验证码，需要对验证码进行自定义配置可以在config/autoload中添加captcha.php进行配置

```
return [
    'fontSize' => env('CAPTCHA_FONTSIZE', 25),
    'useCurve' => env('CAPTCHA_USECURVE', true),
    'useNoise' => env('CAPTCHA_USENOISE', true),
    'imageH'   => env('CAPTCHA_IMAGE_WIDTH', 0),
    'imageW'   => env('CAPTCHA_IMAGE_HEIGHT', 0),
    'length'   => env('CAPTCHA_LENGTH', 5),
    'bg'       => env('CAPTCHA_BG', [243, 251, 254]),
    'reset'    => env('CAPTCHA_RESET', true)
];

```

**直接使用**

```
/**
 * @Inject
 * @var ContainerInterface
 */
protected $container;

// 生产验证码
$captcha = new Captcha($this->container->get(ConfigInterface::class), $this->container->get(SessionInterface::class));
return $captcha->create();

// 验证
$captcha->check($code);

```

#### 动态设置

[](#动态设置)

```
$captcha->setFontSize(25);
$captcha->setImageWidth(100);
$captcha->setImageHeight(50);
$captcha->setLength(4);
$captcha->setUseCurve(true);
$captcha->setUseNoise(true);

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% 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 ~0 days

Total

2

Last Release

1001d ago

PHP version history (2 changes)2.0PHP &gt;=7.2

2.0.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b4561c3f5fcc7820568c832fc93ada174343dc8df5e50e4635231cee52669ce?d=identicon)[minxinqing](/maintainers/minxinqing)

---

Top Contributors

[![lzy309](https://avatars.githubusercontent.com/u/37437279?v=4)](https://github.com/lzy309 "lzy309 (13 commits)")[![minxinqing](https://avatars.githubusercontent.com/u/3809601?v=4)](https://github.com/minxinqing "minxinqing (3 commits)")

---

Tags

phpcaptchahyperf

### Embed Badge

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

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

###  Alternatives

[hyperf/validation

hyperf validation

122.2M200](/packages/hyperf-validation)

PHPackages © 2026

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