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

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

joyqhs/captcha
==============

The Hyperf CAPTCHA package.

v1.0.0(2y ago)01MITPHPPHP &gt;=8.0

Since Aug 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/joyqhs/captcha)[ Packagist](https://packagist.org/packages/joyqhs/captcha)[ RSS](/packages/joyqhs-captcha/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

Hyperf CAPTCHA 组件
=================

[](#hyperf-captcha-组件)

安装
--

[](#安装)

```
composer require joyqhs/captcha
```

发布配置
----

[](#发布配置)

```
php bin/hyperf.php vendor:publish joyqhs/captcha
```

> 字体文件默认发布到 `/storage/fonts` 目录。

组件依赖 `joyqhs/encryption` 组件加解密 `key`，依赖 `hyperf/cache` 组件暂存使用过的 `key`，您需要发布这些组件的配置：

```
php bin/hyperf.php vendor:publish joyqhs/encryption
php bin/hyperf.php vendor:publish hyperf/cache
```

使用
--

[](#使用)

```
use Hyperf\Utils\ApplicationContext;
use Joyqhs\Captcha\CaptchaFactory;

$captchaFactory = ApplicationContext::getContainer()->get(CaptchaFactory::class);

// 生成
$captcha = $captchaFactory->create();
$response = [
    'key' => $captcha->getKey(),
    'blob' => $captcha->getBlob()->toDataUrl(),
    'ttl' => $captcha->getTtl(),
];

// 验证
$captchaFactory->validate($key, $text);
```

### 验证器

[](#验证器)

您可将 `key` 与用户输入用逗号 `,` 连接后传递给 `captcha` 验证规则来自动完成验证，验证成功的 `key` 将被自动暂存到缓存中直至该 `key` 过期。

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

1061d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/152a69926a87e815f3a8e90e3c11540f9ff6685040e5b737333c8ca6251f648b?d=identicon)[joyqhs](/maintainers/joyqhs)

---

Tags

phpcaptchahyperf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[hyperf/validation

hyperf validation

122.2M198](/packages/hyperf-validation)

PHPackages © 2026

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