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

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

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

A captcha componet for hyperf .

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

Since Jun 8Pushed 4y 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 today

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 26% 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

1485d 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

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k50](/packages/ecotone-ecotone)[hyperf/di

A DI for Hyperf.

173.0M690](/packages/hyperf-di)[limingxinleo/hyperf-utils

Utils for Hyperf.

29137.1k3](/packages/limingxinleo-hyperf-utils)[hyperf/socketio-server

Socket.io implementation for hyperf

26140.9k7](/packages/hyperf-socketio-server)

PHPackages © 2026

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