PHPackages                             laravist/geecaptcha - 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. laravist/geecaptcha

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

laravist/geecaptcha
===================

A geetest captcha package by laravist

1.1(10y ago)611.8k25MITPHP

Since Jan 22Pushed 8y ago3 watchersCompare

[ Source](https://github.com/JellyBool/geeCaptcha)[ Packagist](https://packagist.org/packages/laravist/geecaptcha)[ RSS](/packages/laravist-geecaptcha/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

极验证 Composer Package
====================

[](#极验证-composer-package)

视频教程: [Laravist](https://laravist.com/series/tools-that-are-dame-good-for-developer/episodes/1)
-----------------------------------------------------------------------------------------------

[](#视频教程-laravist)

> 说明：由于geetest本身的composer package有很多不必要的文件，这里是最精简的版本，只用于验证码验证。

演示
--

[](#演示)

[![geetesst](https://cloud.githubusercontent.com/assets/6011686/12508320/385a56a6-c136-11e5-9353-b686c85bd37a.gif)](https://cloud.githubusercontent.com/assets/6011686/12508320/385a56a6-c136-11e5-9353-b686c85bd37a.gif)

Usage
-----

[](#usage)

安装 （目前的版本是 1.0）：

```
composer require laravist/geecaptcha

```

1. 实例化

```
 $captcha = new \Laravist\GeeCaptcha\GeeCaptcha($captcha_id, $private_key);
```

2. 使用的使用可以这样判断验证码是否验证成功（通常是post路由里）：

```
 if ($captcha->isFromGTServer() && $captcha->success())
 {
     // 登录的代码逻辑在这里
 }
```

> 注意: 上面第一个判断是检测GT(geetest.com)的服务器是否正常，第二个才是检测验证码是否正确。

3. 对于需要重新生成验证码的时候（通常放在get方式的路由里）：

```
$captcha = new \Laravist\GeeCaptcha\GeeCaptcha($captcha_id, $private_key);
echo $captcha->GTServerIsNormal();
```

Laravel 使用用例
------------

[](#laravel-使用用例)

routes

```
Route::group(['middleware' => ['web']], function () {
    Route::get('/login', function () {
        return view('login');
    });

    Route::post('/verify', function () {
        $captcha = new \Laravist\GeeCaptcha\GeeCaptcha(env('CAPTCHA_ID'), env('PRIVATE_KEY'));
        if ($captcha->isFromGTServer()) {
            if($captcha->success()){
                return 'success';
            }
            return 'no';
        }
        if ($captcha->hasAnswer()) {
                return "answer";
        }
        return "no answer";
    });

    Route::get('/captcha', function () {
        $captcha = new \Laravist\GeeCaptcha\GeeCaptcha(env('CAPTCHA_ID'), env('PRIVATE_KEY'));

        echo $captcha->GTServerIsNormal();
    });

});
```

login视图:

```
>

        Laravel Geetest

                Laravel 5

                    {{ csrf_field() }}

                        邮箱：

                        密码：

                            var handler = function (captchaObj) {
                                // 将验证码加到id为captcha的元素里
                                captchaObj.appendTo("#captcha");
                            };
                            $.ajax({
                                // 获取id，challenge，success（是否启用failback）
                                url: "captcha?rand="+Math.round(Math.random()*100),
                                type: "get",
                                dataType: "json", // 使用jsonp格式
                                success: function (data) {
                                    // 使用initGeetest接口
                                    // 参数1：配置参数，与创建Geetest实例时接受的参数一致
                                    // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件
                                    initGeetest({
                                        gt: data.gt,
                                        challenge: data.challenge,
                                        product: "float", // 产品形式
                                        offline: !data.success
                                    }, handler);
                                }
                            });

                        提交

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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

Every ~79 days

Total

2

Last Release

3726d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9a3647edda6664dd50bca5facf185a03f21940e139c30d7ea286a64b9a8191e?d=identicon)[JellyBool](/maintainers/JellyBool)

---

Top Contributors

[![JellyBool](https://avatars.githubusercontent.com/u/6011686?v=4)](https://github.com/JellyBool "JellyBool (13 commits)")[![mouyong](https://avatars.githubusercontent.com/u/10336437?v=4)](https://github.com/mouyong "mouyong (1 commits)")[![sqrtqiezi](https://avatars.githubusercontent.com/u/7973501?v=4)](https://github.com/sqrtqiezi "sqrtqiezi (1 commits)")

### Embed Badge

![Health badge](/badges/laravist-geecaptcha/health.svg)

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

###  Alternatives

[chaoswey/taiwan-id-validator

台灣身分證、統一編號驗證

319.9k](/packages/chaoswey-taiwan-id-validator)

PHPackages © 2026

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