PHPackages                             shamarkellman/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. [Security](/categories/security)
4. /
5. shamarkellman/laravel-recaptcha

ActiveLibrary[Security](/categories/security)

shamarkellman/laravel-recaptcha
===============================

laravel-recaptcha

02PHP

Since Feb 25Pushed 5y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Recaptch (V3 only)
==========================

[](#laravel-recaptch-v3-only)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3cc74779cf640dc37c79699b0a6167e27a7821292096101674ce9e5ee62da3e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7368616d61726b656c6c6d616e2f6c61726176656c2d7265636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shamarkellman/laravel-recaptcha)[![GitHub Tests Action Status](https://camo.githubusercontent.com/98415d731b77bd186aa95bd7111e9e14bfaf3175d2f6d9668f228c4e93de591c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7368616d61726b656c6c6d616e2f6c61726176656c2d7265636170746368612f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/shamarkellman/laravel-recaptcha/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/698d94a7ba7bd9a95ddf3ed731f915e465b2dcd83ebe80a2d5b78c6ffeed438d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7368616d61726b656c6c6d616e2f6c61726176656c2d7265636170746368612f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/shamarkellman/laravel-recaptcha/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/cdfbf882cc1f3392088d6b7c1ee33fb872136e873661a0da7a29123e16c72ee8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7368616d61726b656c6c6d616e2f6c61726176656c2d7265636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shamarkellman/laravel-recaptcha)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/0572a6bdd391a729fc208c24caf4565d29310c72c83f3d09719206b23f3fbacc/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f7061636b6167652d6c61726176656c2d7265636170746368612d6c61726176656c2e6a70673f743d31)](https://spatie.be/github-ad-click/package-laravel-recaptcha-laravel)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require shamarkellman/laravel-recaptcha
```

You can publish the config file with:

```
php artisan vendor:publish --provider="ShamarKellman\LaravelRecaptcha\LaravelRecaptchaServiceProvider" --tag="laravel-recaptcha-config"
```

This is the contents of the published config file:

```
return [
    'public_key' => env('GOOGLE_CAPTCHA_PUBLIC_KEY'),
    'private_key' => env('GOOGLE_CAPTCHA_PRIVATE_KEY'),
    'score_threshold' => 0.5,
];
```

Usage
-----

[](#usage)

First of all you have to create your own API keys [here](https://www.google.com/recaptcha/admin)

Follow the instructions and at the end of the process you will find Site key and Secret key. Keep them close..you will need soon!

In your .env file you need to set the GOOGLE\_CAPTCHA\_PUBLIC\_KEY and GOOGLE\_CAPTCHA\_PRIVATE\_KEY

```
GOOGLE_CAPTCHA_PUBLIC_KEY=your_site_key
GOOGLE_CAPTCHA_PRIVATE_KEY=your_site_secret_key
```

The package contains blade directives and views. You can use either method to add the ReCaptcha to your site.

Method 1 - Blade Directive

- The input directive should be added to your form

```

    @csrf
    @recaptchaInput

    ... other form feilds

```

(optional) you can add the Recaptcha branding your site using `@recaptchaBranding`

- add the script directive to the bottom just before the end of the body tag

```
@recaptchaScripts
```

- Add validation rule in your form request or validation function

```
use ShamarKellman\LaravelRecaptcha\Rules;

[
    //...other rules,
    'recaptcha_token' => ['required', new  ReCaptchaRule],
];
```

- You can display the error message

```
@error('recaptcha_token')
    {{ $message }}
@enderror
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Shamar Kellman](https://github.com/ShamarKellman)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![ShamarKellman](https://avatars.githubusercontent.com/u/4120411?v=4)](https://github.com/ShamarKellman "ShamarKellman (3 commits)")

### Embed Badge

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

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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