PHPackages                             lshorz/laravel-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. lshorz/laravel-captcha

ActivePackage[Authentication &amp; Authorization](/categories/authentication)

lshorz/laravel-captcha
======================

Laravel Captcha Package

036PHPCI failing

Since Jun 3Pushed 5y agoCompare

[ Source](https://github.com/lshorz/laravel-captcha)[ Packagist](https://packagist.org/packages/lshorz/laravel-captcha)[ RSS](/packages/lshorz-laravel-captcha/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

### 样式

[](#样式)

[![image](preview/1.png)](preview/1.png)[![image](preview/2.png)](preview/2.png)[![image](preview/3.png)](preview/3.png)[![image](preview/4.png)](preview/4.png)[![image](preview/5.png)](preview/5.png)

### composer

[](#composer)

```
composer require "lshorz/laravel-captcha": "dev-master"
```

### 扩展发布

[](#扩展发布)

```
php artisan vendor:public --provider=Lshorz\LaravelCaptcha\CaptchaServiceProvider --tag=config
```

### 配置

[](#配置)

可参考 config/captcha.php

```
return [
    'default' => [
        'name' => 'captcha', //  默认session name
        'length' => 5,   //验证码长度
        'width' => 160,   //图像宽度
        'height' => 50,   //图像高度
        'quality' => 90,   //图像质量
        'noise' => 60,     //噪点数量
        'angle' => 1,      //字体角度(0:则随机角度)
        'distort' => true, //开启图像扭曲度
        'distortType' => 2, //图像扭曲算法
        'distortScale' => 2.0, //图像扭曲度(仅distortType=1有效)
        'lines' => 0,     //干扰线数量(0:则不生成)
        'lineThickness' => mt_rand(1, 3), //干扰线粗细
        //...
    ],
    'number' => [
        'name' => 'number',      //session name
        'length' => mt_rand(4, 5),
        'width' => 120,
        'height' => 40,
        'characters' => '23456789',
        'lines' => mt_rand(1, 3),     //干扰线数量(0:则不生成)
        'lineThickness' => mt_rand(1, 3),
        'distortType' => 1, //图像扭曲算法
        'distortScale' => 2.0, //图像扭曲度(仅distortType=1有效)
    ],
]
```

### 使用例子

[](#使用例子)

```

    submit

```

```
public function check(Request $request)
{
    // 验证函数第二个参数为true,则验证后即清除session
    // 如果在配置中有指定session name则第三个参数必须填写
    dump(captcha_check($request->get('code'), true, 'number'));
}
```

or

```
public function ajaxCheck(Request $request)
{
    $code = $request->get('code');
    //  验证函数第二个参数为false,则验证后不清除session，可用于支持ajax验证，最终提交后再清除session
    $check = captcha_check($request->get('code'), false, 'number');
    $data = [
        'code' => $code,
        'v' => $check
    ];
    return response()->json($data);
}
```

or

```
public function check(Request $request)
{
    $this->validate($request, [
        'title' => 'required|captcha:true,number',
    ]);
}
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fa8b15555911a359726380405a3843084ce208cda8ec21161dd3c137f9dc9ca?d=identicon)[lshorz](/maintainers/lshorz)

---

Top Contributors

[![lshorz](https://avatars.githubusercontent.com/u/12546162?v=4)](https://github.com/lshorz "lshorz (10 commits)")

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-password

Useful password strength validation utilities for Yii Framework 2.0

761.2M17](/packages/kartik-v-yii2-password)

PHPackages © 2026

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