PHPackages                             lshorz/luocaptcha - 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/luocaptcha

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

lshorz/luocaptcha
=================

Laravel of luosimao captcha

1.0(8y ago)62673[2 issues](https://github.com/lshorz/luocaptcha/issues)MITPHPPHP &gt;=7.0

Since Mar 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lshorz/luocaptcha)[ Packagist](https://packagist.org/packages/lshorz/luocaptcha)[ RSS](/packages/lshorz-luocaptcha/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Luosimao 人机验证 Laravel 5.X 扩展
============================

[](#luosimao-人机验证-laravel-5x-扩展)

基于[Luosimao](https://luosimao.com/)免费人机验证的Laravel 5.x扩展

[![介绍](https://camo.githubusercontent.com/b9306b1d8ee9b12ed5863972817b404023a04fa01497d8894b6747824ffee046/68747470733a2f2f732e6c756f73696d616f2e636f6d2f696d616765732f776562736974652f636170746368612f73637265656e73686f742e6a7067)](https://camo.githubusercontent.com/b9306b1d8ee9b12ed5863972817b404023a04fa01497d8894b6747824ffee046/68747470733a2f2f732e6c756f73696d616f2e636f6d2f696d616765732f776562736974652f636170746368612f73637265656e73686f742e6a7067)

安装
--

[](#安装)

```
$ composer require "lshorz/luocaptcha":"dev-master"
```

如果是laravel&lt;5.5 则修改config/app.php 增加

```
Lshorz\Luosimao\LCaptchaServiceProvider::class
```

增加aliases

```
'LCaptcha' => Lshorz\Luosimao\Facades\LCaptcha::class,
```

配置
--

[](#配置)

1.执行

```
$ php artisan vendor:publish --tag=lcaptcha
```

2.去官注册帐号并配置config/lcaptcha.php

使用方法
----

[](#使用方法)

在页面head等合适的地方加入

```

```

在需要显示该验证组件的地方插入以下代码

```
/**
* @param string $width  组件宽度
* @param string $callback 客户端验证成功回调函数名称
*/
{!! LCaptcha::render('100%', 'callback') !!}
```

将会生成类似代html代码

```

```

另外需要自己补充JS方法，例如将取得的response(默认参数名为：*luotest\_response*)参数post到服务器进行远程验证,参考如下：

```

    function callback(resp){
        $.post('/check', {"luotest_response": resp}, function(res){
            console.log(res);
        });
    }

```

### 服务端验证

[](#服务端验证)

方法一：

```
$v = Validator::make($request->only('luotest_response'), ['luotest_response'=>'required|lcaptcha'],
 [
    'luotest_response.required' => '不得为空',
    'luotest_response.lcaptcha'=>'验证失败'
 ]);
if ($v->fails()) {
    return $v->errors();
} else {
    return 'ok';
}
```

方法二：

```
use Lshorz\Luocaptcha\Facades\LCaptcha;

...

$res = LCaptcha::verify($request->only('luotest_response'));
if ($res) {
    echo 'passed';
} else {
    echo 'fail';
}
```

其他请参考：

[luosimao官方使用文档](https://luosimao.com/docs/api/56)
==================================================

[](#luosimao官方使用文档)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

2967d ago

### 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 (6 commits)")

---

Tags

laravelcaptchaLuoSiMao

### Embed Badge

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

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

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[dsoloview/laravel-yandex-captcha

Yandex captcha integration for Laravel

113.9k](/packages/dsoloview-laravel-yandex-captcha)

PHPackages © 2026

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