PHPackages                             crazyinventor/laravel5-recaptcha2 - 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. crazyinventor/laravel5-recaptcha2

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

crazyinventor/laravel5-recaptcha2
=================================

A package to use Google Recaptcha V2 with Laravel 5

1.3(9y ago)27961MITPHPPHP &gt;=5.4.0

Since Sep 25Pushed 9y ago2 watchersCompare

[ Source](https://github.com/crazyinventor/laravel5-recaptcha2)[ Packagist](https://packagist.org/packages/crazyinventor/laravel5-recaptcha2)[ RSS](/packages/crazyinventor-laravel5-recaptcha2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

laravel5-recaptcha2
===================

[](#laravel5-recaptcha2)

Recaptcha v2 for Laravel 5. Inspired by [anhskohbo/no-captcha](https://github.com/anhskohbo/no-captcha) and [greggilbert/recaptcha](https://github.com/greggilbert/recaptcha).

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

[](#installation)

Run 'composer require crazyinventor/laravel5-recaptcha2' or modify your composer.json:

```
{
    "require": {
        "crazyinventor/laravel5-recaptcha2": "1.0.1"
    }
}
```

Configuration
-------------

[](#configuration)

Get your keys for recaptcha from the [admin page](https://www.google.com/recaptcha/admin#list).

Then register the Service Provider.

#### Laravel 5.0

[](#laravel-50)

In `/config/app.php`, add the following to `providers`:

```
'CrazyInventor\Lacaptcha\LacaptchaServiceProvider',

```

and the following to `aliases`:

```
'Recaptcha' => 'CrazyInventor\Lacaptcha\Facades\Lacaptcha',

```

#### Laravel 5.1 and newer

[](#laravel-51-and-newer)

In `/config/app.php`, add the following to `providers`:

```
CrazyInventor\Lacaptcha\LacaptchaServiceProvider::class,

```

and the following to `aliases`:

```
'Recaptcha' => CrazyInventor\Lacaptcha\Facades\Lacaptcha::class,

```

#### Publish config file

[](#publish-config-file)

Publish the `recaptcha` configuration file by running the following command from a shell inside your Laravel's installation directory:

```
php artisan vendor:publish

```

This will create the file `config/recaptcha.php` in your Laravel's installation directory. You can modify this file by entering your sitekey and secret directly to it or adding the keys to your **.env** file.

#### .env file

[](#env-file)

Add `RECAPTCHA_SECRET` and `RECAPTCHA_SITEKEY` to your **.env** file:

```
RECAPTCHA_SECRET=[secret-key]
RECAPTCHA_SITEKEY=[site-key]

```

Replace `[secret-key]` and `[site-key]` with your keys.

Usage
-----

[](#usage)

1. In your form, use `{!! Recaptcha::render() !!}` to echo out the markup.
2. To validate your form, add the following rule:

```
$rules = [
    // ...
    'g-recaptcha-response' => 'required|recaptcha',
];
```

Testing
-------

[](#testing)

When testing your application you might want to skip the recaptcha part. To do so add these lines at the start of your test:

```
// prevent validation error on captcha
Recaptcha::shouldReceive('verify')
    ->once()
    ->andReturn(true);
// provide hidden input for your 'required' validation
Recaptcha::shouldReceive('render')
    ->zeroOrMoreTimes()
    ->andReturn('');
```

Testing with Laravel 5.4 and Dusk
---------------------------------

[](#testing-with-laravel-54-and-dusk)

Unfortunately, mocking does not work for Laravel Dusk. But you can overwrite the validator function very easily by adding the following code to your test.

```
$app = $this->app;
    $app['validator']->extend('recaptcha', function ($attribute, $value) use ($app) {
    return true;
});
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

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 ~87 days

Total

5

Last Release

3533d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/346a7a4ddd8d341c72a895cacb81eb66c5924354b1327c3e71e8435d14a989a5?d=identicon)[CrazyInventor](/maintainers/CrazyInventor)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/crazyinventor-laravel5-recaptcha2/health.svg)

```
[![Health](https://phpackages.com/badges/crazyinventor-laravel5-recaptcha2/health.svg)](https://phpackages.com/packages/crazyinventor-laravel5-recaptcha2)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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