PHPackages                             qingbing/pf-widgets-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. qingbing/pf-widgets-captcha

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

qingbing/pf-widgets-captcha
===========================

渲染部件——图片验证码，验证码模型验证

1.0.1(6y ago)0564MITPHP

Since May 21Pushed 6y agoCompare

[ Source](https://github.com/qingbing/pf-widgets-captcha)[ Packagist](https://packagist.org/packages/qingbing/pf-widgets-captcha)[ Docs](http://www.phpcorner.net)[ RSS](/packages/qingbing-pf-widgets-captcha/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (7)Versions (2)Used By (4)

pf-widgets-captcha
==================

[](#pf-widgets-captcha)

描述
--

[](#描述)

渲染部件——图片验证码，验证码模型验证

注意事项
----

[](#注意事项)

- 该组件基于"qingbing/php-render"上开发运行
- "\\Captcha" 必须配置在继承了"\\Render\\Controller"的控制器上
- 默认 ?refresh=1表示获取一个新的验证码的地址的接收回调
- 支持验证码的模型验证，验证类型为验证类名"\\CaptchaSupports\\CaptchaValidator"，简化为："\\Captcha::VALIDATOR"
- 如果使用视图小部件"\\Widgets\\Captcha"，务必注意一下几点
    - 在页面头引入jquery组件

使用方法
----

[](#使用方法)

### 1. 验证码控制器声明

[](#1-验证码控制器声明)

```
    /**
     * 定义外部action列表
     * @return array
     */
    public function actions()
    {
        return [
            'captcha' => [
                'class' => '\Captcha',
                'attribute1' => 'value1',
                'attribute...' => 'value...',
            ],
        ];
    }
```

### 2. 验证组件视图使用方法

[](#2-验证组件视图使用方法)

```
$this->widget('\Widgets\Captcha', [
    'action' => '/site/captcha',
    'alt' => '验证码',
    'attributes' => [
        'id' => 'xxxx',
        'otherAttributes' => 'otherAttributes',
    ],
]);
```

### 3. 模型验证配置

[](#3-模型验证配置)

```
class TestLoginModel extends FormModel
{
    /* 验证码 */
    public $verifyCode;

    public function rules()
    {
        return [
            ['verifyCode', \Captcha::VALIDATOR, 'captchaAction' => 'site/captcha', 'allowEmpty' => false],
        ];
    }
}
```

====== 异常代码集合 ======
--------------------

[](#-异常代码集合-)

异常代码格式：1023 - XXX - XX （组件编号 - 文件编号 - 代码内异常）

```
 - 102300101 : \CaptchaSupports\CaptchaValidator.action"{id}"无效，无法找到指定的action

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

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

Unknown

Total

1

Last Release

2549d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9379d2ee4885074de75faa3fa12970614186826f762df3c4aa0905dc1ff3b513?d=identicon)[qingbing](/maintainers/qingbing)

---

Top Contributors

[![qingbing](https://avatars.githubusercontent.com/u/33932784?v=4)](https://github.com/qingbing "qingbing (2 commits)")

---

Tags

phpvalidatormodelcaptchavalidate

### Embed Badge

![Health badge](/badges/qingbing-pf-widgets-captcha/health.svg)

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

###  Alternatives

[tecactus/reniec-php

RENIEC package for PHP

118.4k](/packages/tecactus-reniec-php)[yiibr/yii2-br-validator

Provide validations and features for brazilian localization

14103.2k4](/packages/yiibr-yii2-br-validator)

PHPackages © 2026

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