PHPackages                             bkstar123/laravel-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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. bkstar123/laravel-recaptcha

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

bkstar123/laravel-recaptcha
===========================

Google reCaptcha v2 checkbox &amp; v3 validation

1.1.4(6y ago)27011MITPHPPHP ^7.1.3

Since Jun 9Pushed 6y agoCompare

[ Source](https://github.com/bkstar123/laravel-recaptcha)[ Packagist](https://packagist.org/packages/bkstar123/laravel-recaptcha)[ RSS](/packages/bkstar123-laravel-recaptcha/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (12)Used By (1)

laravel-recaptcha
=================

[](#laravel-recaptcha)

This package adds reCaptcha\_v2 Checkbox and reCaptcha\_v3 validation. Both versions of reCaptcha can be used together

1.Requirements
--------------

[](#1requirements)

It is recommended to install this package with PHP version 7.1.3+ and Laravel Framework version 5.5+

2.Installation
--------------

[](#2installation)

```
composer require bkstar123/laravel-recaptcha

```

For `reCaptcha_v2 Checkbox`, add the following settings in the .env file:
`GOOGLE_RECAPTCHA_KEY=`
`GOOGLE_RECAPTCHA_SECRET=`

For `reCaptcha_v3`, add the following settings in the .env file:
`GOOGLE_RECAPTCHA3_KEY=`
`GOOGLE_RECAPTCHA3_SECRET=`
`GOOGLE_RECAPTCHA3_THRESHOLD=` (optional, by default set to 0.5)

3. Usage for reCaptcha v2 checkbox
----------------------------------

[](#3-usage-for-recaptcha-v2-checkbox)

### 3.1 In Blade view

[](#31-in-blade-view)

You can add Google reCaptcha v2 validation to your site by simply calling `{{ Recaptcha::addClient() }}`

**Note**: **Recaptcha** alias is automatically registered, so you do not need to add it in the `config/app.php`

The following input will be automatically added to your view and being validated in the validation logic

```

```

You can also display the validation result to the view as follows (use CSS styling to highlight the validation error):

```

        {{ Recaptcha::addClient() }}
        @if ($errors->has('g-recaptcha-response'))

                {{ $errors->first('g-recaptcha-response') }}

        @endif

```

### 3.2 In validation logic

[](#32-in-validation-logic)

You can use a new custom validation rule `recaptcha` against the attribute `g-recaptcha-response`, for example:

```
$request->validate([
    'g-recaptcha-response' => 'required|recaptcha'
], [
    'g-recaptcha-response.recaptcha' => 'Please make sure you are not a robot',
    'g-recaptcha-response.required' => 'Re-captcha field is required'
]);
```

4. Usage for reCaptcha v3
-------------------------

[](#4-usage-for-recaptcha-v3)

### 4.1 In Blade view

[](#41-in-blade-view)

**Firstly**, you need to call `addClient3Html()` method on `Recaptcha` facade, for example:

```
{{ Recaptcha::addClient3Html('recaptcha3') }}
```

This call will create a hidden input as follows:

```

```

You can display the validation error by adding the following snippet:

```
@if ($errors->has('recaptcha3'))

        {{ $errors->first('recaptcha3') }}

@endif
```

**Secondly**, you need to call `addClient3Js()` method on `Recaptcha` facade, for example:

```
{{ Recaptcha::addClient3Js('', 'recaptcha3') }}
```

This call will create a Javascript block as follows:

```

    grecaptcha.ready(function() {
        grecaptcha.execute('', {action: ''})
                  .then(function (token) {
                    if (token) {
                        document.getElementById('recaptcha3').value = token;
                    }
                  });
    });

```

### 4.2 In Validation logic

[](#42-in-validation-logic)

You can use a new custom validation rule `recaptcha_v3` against the attribute `recaptcha3`, for example:

```
$request->validate([
    'recaptcha3' => 'recaptcha_v3'
], ['recaptcha_v3' => 'You are not a human']);
```

**Note**:

- You can give an arbitrary name for `action_name` as long as it contains only a-z, A-Z and \_
- Also for attribute name, you can use an arbitrary string other than `recaptcha3`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Recently: every ~27 days

Total

10

Last Release

2418d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90147e91656dcac27be0a14b7600445eae40a5a8f3859f8ac9e1f9a051626095?d=identicon)[bkstar123](/maintainers/bkstar123)

---

Top Contributors

[![bkstar123](https://avatars.githubusercontent.com/u/12879662?v=4)](https://github.com/bkstar123 "bkstar123 (11 commits)")

---

Tags

laravel-recaptchalaravel-recaptcha-v2laravel-recaptcha-v3recaptcharecaptcha-v2recaptcha-v3laravelvalidatorvalidationrecaptcha v3Laravel reCAPTCHAreCAPTCHA V2

### Embed Badge

![Health badge](/badges/bkstar123-laravel-recaptcha/health.svg)

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

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

184485.5k](/packages/illuminatech-validation-composite)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.3k](/packages/stuyam-laravel-phone-validator)[laravel-validation-rules/timezone

Validate that a given timezone is valid.

2119.0k](/packages/laravel-validation-rules-timezone)

PHPackages © 2026

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