vividcortex/recaptcha-validator

此包已被弃用且不再维护。作者建议使用google/recaptcha包。

reCaptcha验证器

v0.1.1 2016-02-05 18:51 UTC

This package is not auto-updated.

Last update: 2020-12-15 17:48:44 UTC


README

弃用通知

此包已被弃用,转而使用Google自家的reCaptcha验证器

用PHP编写的Google reCaptcha响应的简单验证器。

Build status

安装

使用composer添加项目依赖。

composer require vividcortex/recaptcha-validator

工作原理

首先,您需要使用Google提供的密钥实例化一个新的验证器

use VividCortex\RecaptchaValidator\Validator;

// ...

$validator = new Validator($secret);

然后,您可以继续验证响应。需要响应和客户端IP。

// Returns TRUE or FALSE
$result = $validator->validate($response, $clientIp);