PHPackages                             josiasmontag/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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. josiasmontag/laravel-recaptchav3

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

josiasmontag/laravel-recaptchav3
================================

Recaptcha V3 for Laravel package

1.0.5(2mo ago)2641.6M↑14.9%48[24 issues](https://github.com/josiasmontag/laravel-recaptchav3/issues)[4 PRs](https://github.com/josiasmontag/laravel-recaptchav3/pulls)2MITPHPPHP &gt;=7.1.0CI passing

Since Oct 30Pushed 1mo ago2 watchersCompare

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

READMEChangelog (3)Dependencies (14)Versions (14)Used By (2)

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

[](#laravel-recaptcha-v3)

[![Build Status](https://github.com/josiasmontag/laravel-recaptchav3/actions/workflows/run-tests.yml/badge.svg)](https://github.com/josiasmontag/laravel-recaptchav3/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/955dda8b7d8fce2021879a241954bdea87ebf0c634ef8dc1dabde364452fb38d/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736961736d6f6e7461672f6c61726176656c2d72656361707463686176332f642f746f74616c2e737667)](https://packagist.org/packages/josiasmontag/laravel-recaptchav3)[![Latest Stable Version](https://camo.githubusercontent.com/22ce8d1696311c7ba89f85f83fda99862b5201557ee443ad339adaf551c14b64/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736961736d6f6e7461672f6c61726176656c2d72656361707463686176332f762f737461626c652e737667)](https://packagist.org/packages/josiasmontag/laravel-recaptchav3)[![License](https://camo.githubusercontent.com/901f653db7bed2c092647acbc1acd3c55cb867924e95229296b668d81f11acb5/68747470733a2f2f706f7365722e707567782e6f72672f6a6f736961736d6f6e7461672f6c61726176656c2d72656361707463686176332f6c6963656e73652e737667)](https://packagist.org/packages/josiasmontag/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 josiasmontag/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="Lunaweb\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($action, $name='g-recaptcha-response')` creates an invisible input field that gets filled with a Recaptcha token on load.

```

    {!! RecaptchaV3::field('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 Lunaweb\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

62

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 71.9% 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 ~222 days

Recently: every ~304 days

Total

13

Last Release

84d ago

Major Versions

0.6.0 → 1.0.02022-02-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/07b14ffb44d0a4e799d313482990b85e88f70d0f1a3bdbb9189134c499c4e695?d=identicon)[josiasmontag](/maintainers/josiasmontag)

---

Top Contributors

[![josiasmontag](https://avatars.githubusercontent.com/u/1945577?v=4)](https://github.com/josiasmontag "josiasmontag (23 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (5 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)")

---

Tags

phplaravelrecaptchacaptcha

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[albertcht/invisible-recaptcha

Invisible reCAPTCHA For Laravel.

6031.6M6](/packages/albertcht-invisible-recaptcha)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)

PHPackages © 2026

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