PHPackages                             hyperf-ljh/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hyperf-ljh/captcha

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hyperf-ljh/captcha
==================

适用于hyperf的图形验证码

v1.0.2(3y ago)142MITPHPPHP &gt;=8.0

Since Mar 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lijinhua1993/hyperf-pkg-captcha)[ Packagist](https://packagist.org/packages/hyperf-ljh/captcha)[ RSS](/packages/hyperf-ljh-captcha/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (4)Used By (0)

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

[](#hyperf-captcha-组件)

安装
--

[](#安装)

```
composer require hyperf-ljh/captcha
```

发布配置
----

[](#发布配置)

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

> 字体文件默认发布到 `/storage/fonts` 目录。 组件依赖 `hyperf-ljh/encryption` 组件加解密 `key`，依赖 `hyperf/cache` 组件暂存使用过的 `key`，您需要发布这些组件的配置：

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

使用
--

[](#使用)

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

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~0 days

Total

3

Last Release

1200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed2589da2f1c2e3081fbdd8627483fa334cb2972d60b01da70a114d9edf527df?d=identicon)[lijinhua](/maintainers/lijinhua)

---

Top Contributors

[![lijinhua1993](https://avatars.githubusercontent.com/u/36188950?v=4)](https://github.com/lijinhua1993 "lijinhua1993 (3 commits)")

---

Tags

phpcaptchahyperf

### Embed Badge

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

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

###  Alternatives

[hyperf/watcher

Hot reload watcher for Hyperf

17904.9k31](/packages/hyperf-watcher)

PHPackages © 2026

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