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

ActiveLibrary

xyu/hyperf-captcha
==================

A captcha componet for hyperf .

v1.0.3(3y ago)01.3kMITPHPPHP &gt;=7.2

Since Jun 8Pushed 3y agoCompare

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

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

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

[](#验证码组件)

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

```
composer require xyu/hyperf-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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity46

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

Every ~0 days

Total

4

Last Release

1431d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f144b31c29aa87fa768e0ffd9909b8e7b50c9328ac1e962f8be00d284bd66ef0?d=identicon)[x.yu](/maintainers/x.yu)

---

Tags

phpcaptchahyperf

### Embed Badge

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

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

###  Alternatives

[limingxinleo/hyperf-utils

Utils for Hyperf.

29133.9k3](/packages/limingxinleo-hyperf-utils)

PHPackages © 2026

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