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

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

enoliu/captcha
==============

The Hyperf CAPTCHA package.

v3.0.1(3y ago)042MITPHPPHP &gt;=8.0

Since Mar 7Pushed 3y agoCompare

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

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

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

[](#hyperf-captcha-组件)

安装
--

[](#安装)

```
composer require hyperf-ext/captcha
```

发布配置
----

[](#发布配置)

```
php bin/hyperf.php vendor:publish hyperf-ext/captcha
```

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

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

```
php bin/hyperf.php vendor:publish hyperf-ext/encryption
php bin/hyperf.php vendor:publish hyperf/cache
```

使用
--

[](#使用)

```
use Hyperf\Utils\ApplicationContext;
use HyperfExt\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

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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

1167d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/95390f946efd93603b9f40162ef504684198c99b55fdd175ab47c8f48844b02b?d=identicon)[Enoliu](/maintainers/Enoliu)

---

Top Contributors

[![ericyzhu](https://avatars.githubusercontent.com/u/1786762?v=4)](https://github.com/ericyzhu "ericyzhu (3 commits)")[![Enoliu](https://avatars.githubusercontent.com/u/25947382?v=4)](https://github.com/Enoliu "Enoliu (2 commits)")

---

Tags

phpcaptchahyperf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

PHPackages © 2026

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