PHPackages                             lostlink/laravel-recaptchav3 - 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. lostlink/laravel-recaptchav3

ActiveLibrary

lostlink/laravel-recaptchav3
============================

Recaptcha V3 for Laravel package

01.8kPHP

Since Oct 17Pushed 1y agoCompare

[ Source](https://github.com/lostlink/laravel-recaptchav3)[ Packagist](https://packagist.org/packages/lostlink/laravel-recaptchav3)[ RSS](/packages/lostlink-laravel-recaptchav3/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Recaptcha V3
====================

[](#laravel-recaptcha-v3)

[![Build Status](https://github.com/lostlink/laravel-recaptchav3/actions/workflows/run-tests.yml/badge.svg)](https://github.com/lostlink/laravel-recaptchav3/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/7dd5ffc5ce1f311183867c9dbab61da42639ebc05926dacbe088211ced4271f9/68747470733a2f2f706f7365722e707567782e6f72672f6c6f73746c696e6b2f6c61726176656c2d72656361707463686176332f642f746f74616c2e737667)](https://packagist.org/packages/lostlink/laravel-recaptchav3)[![Latest Stable Version](https://camo.githubusercontent.com/f931925598fa2d228da1f879eb96bb9113b56030a9e1926733239dbfc051019b/68747470733a2f2f706f7365722e707567782e6f72672f6c6f73746c696e6b2f6c61726176656c2d72656361707463686176332f762f737461626c652e737667)](https://packagist.org/packages/lostlink/laravel-recaptchav3)[![License](https://camo.githubusercontent.com/0eca531f15d30404a83ee02c7052a9e804a8136897b072dcd31cebc76b1e7bd9/68747470733a2f2f706f7365722e707567782e6f72672f6c6f73746c696e6b2f6c61726176656c2d72656361707463686176332f6c6963656e73652e737667)](https://packagist.org/packages/lostlink/laravel-recaptchav3)

Laravel package for Google's [Recaptcha V3](https://developers.google.com/recaptcha/docs/v3). This is a lightweight package which focuses on the backend validation of Recaptcha V3 captchas.

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

[](#installation)

To get started, use Composer to add the package to your project's dependencies:

```
composer require lostlink/laravel-recaptchav3

```

Add `RECAPTCHAV3_SITEKEY` and `RECAPTCHAV3_SECRET` to your `.env` file. (You can get them [here](https://www.google.com/recaptcha/admin#list))

```
RECAPTCHAV3_SITEKEY=sitekey
RECAPTCHAV3_SECRET=secret

```

Optionally, you can publish the config file:

```
php artisan vendor:publish --provider="Lostlink\RecaptchaV3\Providers\RecaptchaV3ServiceProvider"

```

Usage
-----

[](#usage)

#### Init Recaptcha Javascript

[](#init-recaptcha-javascript)

Recaptcha v3 works best when it is loaded on every page to get the most context about interactions. Therefore, add to your header or footer template:

```
{!! RecaptchaV3::initJs() !!}
```

#### Forms

[](#forms)

`RecaptchaV3::field($form, $action, $name='g-recaptcha-response')` creates an invisible input field that gets filled with a Recaptcha token on form submit.

```

    {!! RecaptchaV3::field('register', 'register') !!}

```

#### Validation

[](#validation)

Add the `recaptchav3` validator to the rules array. The rule accepts two parameters: The `action` name and the minimum required `score` (defaults to 0.5).

```
$validate = Validator::make(Input::all(), [
	'g-recaptcha-response' => 'required|recaptchav3:register,0.5'
]);
```

#### Getting the score

[](#getting-the-score)

Alternatively, you can get the score and take variable action:

```
// Import the facade class
use Lostlink\RecaptchaV3\Facades\RecaptchaV3;
//  RecaptchaV3::verify($token, $action)
$score = RecaptchaV3::verify($request->get('g-recaptcha-response'), 'register')
if($score > 0.7) {
    // go
} elseif($score > 0.3) {
    // require additional email verification
} else {
    return abort(400, 'You are most likely a bot');
}
```

#### Custom validation error message

[](#custom-validation-error-message)

Add the following values to the `custom` array in the `validation` language file:

```
'custom' => [
    'g-recaptcha-response' => [
        'recaptchav3' => 'Captcha error message',
    ],
],
```

#### Hiding the ReCAPTCHA Badge

[](#hiding-the-recaptcha-badge)

Add to your CSS file:

```
.grecaptcha-badge { visibility: hidden !important; }
```

#### Localization

[](#localization)

By default, the package follows the default application locale, which is defined in `config/app.php`. If you want to change this behavior, you can specify what locale to use by adding a new environment variable :

```
RECAPTCHAV3_LOCALE=ar

```

#### Testing

[](#testing)

To make your forms testable, you can mock the `RecaptchaV3` facade:

```
RecaptchaV3::shouldReceive('verify')
    ->once()
    ->andReturn(1.0);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![josiasmontag](https://avatars.githubusercontent.com/u/1945577?v=4)](https://github.com/josiasmontag "josiasmontag (15 commits)")[![nsouto](https://avatars.githubusercontent.com/u/986996?v=4)](https://github.com/nsouto "nsouto (6 commits)")[![tderick](https://avatars.githubusercontent.com/u/81715817?v=4)](https://github.com/tderick "tderick (2 commits)")[![bondif](https://avatars.githubusercontent.com/u/24433897?v=4)](https://github.com/bondif "bondif (1 commits)")[![Joeri-KIXX](https://avatars.githubusercontent.com/u/38066185?v=4)](https://github.com/Joeri-KIXX "Joeri-KIXX (1 commits)")

### Embed Badge

![Health badge](/badges/lostlink-laravel-recaptchav3/health.svg)

```
[![Health](https://phpackages.com/badges/lostlink-laravel-recaptchav3/health.svg)](https://phpackages.com/packages/lostlink-laravel-recaptchav3)
```

PHPackages © 2026

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