PHPackages                             jakreiter/recaptchaproxyable - 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. jakreiter/recaptchaproxyable

ActiveLibrary

jakreiter/recaptchaproxyable
============================

Client library for reCAPTCHA, a free service that protects websites from spam and abuse.

1.3.1(1y ago)01.2k—0%1BSD-3-ClausePHPPHP &gt;=8CI passing

Since Mar 12Pushed 1y agoCompare

[ Source](https://github.com/jakreiter/recaptcha)[ Packagist](https://packagist.org/packages/jakreiter/recaptchaproxyable)[ Docs](https://www.google.com/recaptcha/)[ RSS](/packages/jakreiter-recaptchaproxyable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (14)Used By (1)

reCAPTCHA PHP client library
============================

[](#recaptcha-php-client-library)

[![Build Status](https://camo.githubusercontent.com/7d606b1bd1b840c6d5e65df1505256f4188ad80fb5f51671a8a1adc36e0b438b/68747470733a2f2f7472617669732d63692e6f72672f676f6f676c652f7265636170746368612e737667)](https://travis-ci.org/google/recaptcha)[![Coverage Status](https://camo.githubusercontent.com/c435e37b6d0dd557ac2d05e5ece1779b076374b2a038e7eec5736da6c582da12/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f676f6f676c652f7265636170746368612f62616467652e737667)](https://coveralls.io/github/google/recaptcha)[![Latest Stable Version](https://camo.githubusercontent.com/f348199d29a2fa126ca55f17e871cf860d05d044ac1532baeb64a67381ca3a74/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c652f7265636170746368612f762f737461626c652e737667)](https://packagist.org/packages/google/recaptcha)[![Total Downloads](https://camo.githubusercontent.com/00da3996a33ed1d5619a55eae54e07a2e9e1328f3b7686f224c05591063023c5/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c652f7265636170746368612f646f776e6c6f6164732e737667)](https://packagist.org/packages/google/recaptcha)

reCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse. This is a PHP library that wraps up the server-side verification step required to process responses from the reCAPTCHA service. This client supports both v2 and v3.

- reCAPTCHA:
- This repo:
- Hosted demo:
- Version: 1.3.0
- License: BSD, see [LICENSE](LICENSE)

Installation
------------

[](#installation)

### Composer (recommended)

[](#composer-recommended)

Use [Composer](https://getcomposer.org) to install this library from Packagist: [`google/recaptcha`](https://packagist.org/packages/google/recaptcha)

Run the following command from your project directory to add the dependency:

```
composer require google/recaptcha "^1.3"
```

Alternatively, add the dependency directly to your `composer.json` file:

```
"require": {
    "google/recaptcha": "^1.3"
}
```

### Support for earlier versions of PHP

[](#support-for-earlier-versions-of-php)

The 1.3 release moves to PHP 8 and up. For earlier versions, you will need to stay with the 1.2 releases.

### Direct download

[](#direct-download)

Download the [ZIP file](https://github.com/google/recaptcha/archive/master.zip)and extract into your project. An autoloader script is provided in `src/autoload.php` which you can require into your script. For example:

```
require_once '/path/to/recaptcha/src/autoload.php';
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
```

The classes in the project are structured according to the [PSR-4](https://www.php-fig.org/psr/psr-4/) standard, so you can also use your own autoloader or require the needed files directly in your code.

Usage
-----

[](#usage)

First obtain the appropriate keys for the type of reCAPTCHA you wish to integrate for v2 at  or v3 at .

Then follow the [integration guide on the developer site](https://developers.google.com/recaptcha/intro) to add the reCAPTCHA functionality into your frontend.

This library comes in when you need to verify the user's response. On the PHP side you need the response from the reCAPTCHA service and secret key from your credentials. Instantiate the `ReCaptcha` class with your secret key, specify any additional validation rules, and then call `verify()` with the reCAPTCHA response (usually in `$_POST['g-recaptcha-response']` or the response from `grecaptcha.execute()` in JS which is in `$gRecaptchaResponse` in the example) and user's IP address. For example:

```
