PHPackages                             rain\_sunshine\_cloud/php\_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. rain\_sunshine\_cloud/php\_captcha

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

rain\_sunshine\_cloud/php\_captcha
==================================

v1.0(7y ago)010PHPPHP &gt;=5.3.0

Since Dec 26Pushed 7y agoCompare

[ Source](https://github.com/RainSunshineCloud/php_captcha)[ Packagist](https://packagist.org/packages/rain_sunshine_cloud/php_captcha)[ RSS](/packages/rain-sunshine-cloud-php-captcha/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

验证码生成器
======

[](#验证码生成器)

该验证码采用font字体和width height 各自生成的策略，当字体所需空间小于width 和 height 的宽高时，保持原有大小，超过该大小时，自动缩放为固定大小
--------------------------------------------------------------------------------------

[](#该验证码采用font字体和width-height-各自生成的策略当字体所需空间小于width-和-height-的宽高时保持原有大小超过该大小时自动缩放为固定大小)

文件
--

[](#文件)

### CaptchaAbstract 为生成验证码的抽象类，必须实现三个抽象方法

[](#captchaabstract-为生成验证码的抽象类必须实现三个抽象方法)

```
    /**
     * 存储验证码
     * @param  string $key [存储使用的键]
     * @param  string $text [验证码]
     * @return [bool]
     */
    protected abstract  function storeText(string $key,string $text);

    /**
     * 获取存储的字符串
     * @param  string $key [存储使用的键]
     * @return [string]    存储的验证码
     */
    protected abstract  function getStoreText(string $key);

    /**
     * 删除存储的字符串
     * @param  string $key [存储使用的键]
     * @return [bool]
     */
    protected abstract function deleteStoreText(string $key);

```

### Captcha 为CaptchaAbstract 的一种实现，采用session 存储 验证码；

[](#captcha-为captchaabstract-的一种实现采用session-存储-验证码)

usage
-----

[](#usage)

```
$res->create('sjfdh'); //生成验证码图像 ,
$res->create('./file/img.png'); //将生成的验证码存储在某个文件内，只支持保存为png；
$res->verify('sdfkj','key'); //验证码验证，不区分大小写，存储使用的键为key
$res->verify('sjdfjk','key',true); //验证码验证，区分大小写，存储使用的键为key

```

### 其他设置请自行查看抽象类方法

[](#其他设置请自行查看抽象类方法)

### create 方法和 verify 支持静态调用

[](#create-方法和-verify-支持静态调用)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

2692d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/041cb2d7e5d63d922726b229061fd63ca04abca4dce719fba94eb1dc4129aaea?d=identicon)[RainSunshineCloud](/maintainers/RainSunshineCloud)

---

Top Contributors

[![RainSunshineCloud](https://avatars.githubusercontent.com/u/32010961?v=4)](https://github.com/RainSunshineCloud "RainSunshineCloud (19 commits)")

### Embed Badge

![Health badge](/badges/rain-sunshine-cloud-php-captcha/health.svg)

```
[![Health](https://phpackages.com/badges/rain-sunshine-cloud-php-captcha/health.svg)](https://phpackages.com/packages/rain-sunshine-cloud-php-captcha)
```

###  Alternatives

[dompdf/php-font-lib

A library to read, parse, export and make subsets of different types of font files.

1.8k31.2M9](/packages/dompdf-php-font-lib)[geertw/ip-anonymizer

IPv4 and IPv6 address anonymizer

60238.3k1](/packages/geertw-ip-anonymizer)[usu/codice-fiscale

A library to calculate and check the validity of the italian fiscal code (codice fiscale)

23170.9k1](/packages/usu-codice-fiscale)[kzykhys/steganography

Simple implementation of Steganography (Hiding a hidden message within an image)

889.7k](/packages/kzykhys-steganography)[furqansiddiqui/ethereum-php

A modern, dependency-light Ethereum library powered by a clean cryptographic core

1724.9k1](/packages/furqansiddiqui-ethereum-php)[crisen/ai

优雅的ai客户端

265.5k1](/packages/crisen-ai)

PHPackages © 2026

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