PHPackages                             lptech-asia/lp-recaptcha - 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. lptech-asia/lp-recaptcha

ActiveLibrary

lptech-asia/lp-recaptcha
========================

The simple Gooogle recaptcha libraries, use same with google recaptcha libraries however low code, optimize.

1.0.1(3y ago)014LGPL-3.0PHPPHP &gt;=5.0.0

Since Jan 27Pushed 3y agoCompare

[ Source](https://github.com/lptech-asia/lp-recaptcha)[ Packagist](https://packagist.org/packages/lptech-asia/lp-recaptcha)[ Docs](https://github.com/lptech-asia/lp-recaptcha/)[ RSS](/packages/lptech-asia-lp-recaptcha/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

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

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

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:
- Version: 1.0.0
- License: BSD, see [LICENSE](LICENSE)

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

[](#installation)

### Composer (recommended)

[](#composer-recommended)

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

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

```
composer require lptech-asia/lp-recaptcha "master"
```

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

```
"require": {
    "lptech-asia/lp-recaptcha": "master"
}
```

### Direct download

[](#direct-download)

Download the [ZIP file](https://github.com/lptech-asia/lp-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.php';
$recaptcha = new LPRecaptcha('secret-key');
```

The classes in the project are structured according to the [PSR-4](http://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 `LPRecaptcha` 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:

```
