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

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

dianthink/captcha
=================

Captcha for Lumen，Lumen 验证码

v1.0(3y ago)02MITPHPPHP &gt;=8.0.1

Since Jul 14Pushed 3y ago1 watchersCompare

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

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

Captcha for Lumen
=================

[](#captcha-for-lumen)

基于 [Captcha for Laravel 5](https://github.com/mewebstudio/captcha "Captcha for Laravel 5") 修改而来的

> A simple [Laravel 5](http://www.laravel.com/) service provider for including the [Captcha for Laravel 5](https://github.com/mewebstudio/captcha).

update
------

[](#update)

支持了lumen 6x

源于
--

[](#源于)

Captcha for Laravel 5 作者很久没有更新了，同时 Captcha 在 Lumen 有很多错误

由此我基于原 Captcha 包进行了一些错误修复来集成 Lumen 。 同时删除了一些个人觉得太过冗余的东西，让使用更加方便和自由

安装
--

[](#安装)

```
composer require youngyezi/captcha

```

使用
--

[](#使用)

> 新版的包已经删除了 session 支持，完全交给业务自由选择存储方式
>
> 个人觉得这样更方便来解耦业务，尤其 Lumen 大多时候用来做 Api 开发，并不需要开启 Session 服务

### 注册服务 `bootstrap\app.php`

[](#注册服务-bootstrapappphp)

```
$app->register(Youngyezi\Captcha\CaptchaServiceProvider::class);

// 添加别名
$app->alias('captcha', 'Youngyezi\Captcha\CaptchaServiceProvider');

```

### 配置文件

[](#配置文件)

复制 `config/captcha.php` 至 项目 `config` 文件下

For Example
-----------

[](#for-example)

### 验证码生成

[](#验证码生成)

```
//  创建验证码
//  配置文件 key($config)
//  返回 验证码 captcha 和相关 key
$data = app('captcha')->create();

//  自定义储存 key （如 redis ，session 等）

....

//  返回验证码图片 img

```

### 验证码校验

[](#验证码校验)

```
// 通过 code 和 key 来校验
$captcha = $request->input('captcha');

// 获取自定义存储的 key 值
$key = { ... };

if(app('captcha')->check($captcha, $key) === false) {
	   //校验失败
}

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

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

Unknown

Total

1

Last Release

1403d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fa1f6b5e9c83f274ef8acf07eb38ec13f9bec28a58dadd120eb5740f34a072e?d=identicon)[dianthink](/maintainers/dianthink)

---

Top Contributors

[![dianthink](https://avatars.githubusercontent.com/u/9069007?v=4)](https://github.com/dianthink "dianthink (6 commits)")

### Embed Badge

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

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

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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