PHPackages                             ntoufoudis/no-captcha - 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. ntoufoudis/no-captcha

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

ntoufoudis/no-captcha
=====================

No CAPTCHA reCAPTCHA For Laravel.

1.0.0(10mo ago)13MITPHPPHP ^8.3CI passing

Since Aug 22Pushed 10mo agoCompare

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

READMEChangelog (1)Dependencies (7)Versions (5)Used By (0)

No CAPTCHA reCAPTCHA
====================

[](#no-captcha-recaptcha)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f0cdf39e4fb1c061c4fa6c58dca5baafc4a612144cca6d464d5f51395f2df89f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e746f75666f756469732f6e6f2d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ntoufoudis/no-captcha)[![GitHub Tests Action Status](https://camo.githubusercontent.com/76939e9588430cc12999715658617cbf86e65637c1b74b2bb52d9981871b71c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e746f75666f756469732f6e6f2d636170746368612f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ntoufoudis/no-captcha/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b823d078a2c1380f8b56bb9ccc75ef6696e13f6308c998eb988829b75b72b395/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e746f75666f756469732f6e6f2d636170746368612f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ntoufoudis/no-captcha/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/16f0af4cb1b214fa15e55bad4cde03093c5cb2b7efc048bec33f37a8856a6ed4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e746f75666f756469732f6e6f2d636170746368612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ntoufoudis/no-captcha)

[![recaptcha_anchor_2x](https://cloud.githubusercontent.com/assets/1529454/5291635/1c426412-7b88-11e4-8d16-46161a081ece.gif)](https://cloud.githubusercontent.com/assets/1529454/5291635/1c426412-7b88-11e4-8d16-46161a081ece.gif)

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

[](#installation)

You can install the package via composer:

```
composer require ntoufoudis/no-captcha
```

You can publish the config file with:

```
php artisan vendor:publish --tag="no-captcha-config"
```

This is the contents of the published config file:

```
return [
];
```

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

[](#configuration)

Add `NOCAPTCHA_SECRET` and `NOCAPTCHA_SITEKEY` in **.env** file:

```
NOCAPTCHA_SECRET=secret-key
NOCAPTCHA_SITEKEY=site-key

```

(You can obtain them from [here](https://www.google.com/recaptcha/admin))

Usage
-----

[](#usage)

### Init js source

[](#init-js-source)

With default options:

```
{!! NoCaptcha::renderJs() !!}
```

With [language\_support](https://developers.google.com/recaptcha/docs/language) or [onloadCallback](https://developers.google.com/recaptcha/docs/display#explicit_render) options:

```
{!! NoCaptcha::renderJs('fr', true, 'recaptchaCallback') !!}
```

### Display reCAPTCHA

[](#display-recaptcha)

Default widget:

```
{!! NoCaptcha::display() !!}
```

With [custom\_attributes](https://developers.google.com/recaptcha/docs/display#render_param) (theme, size, callback ...):

```
{!! NoCaptcha::display(['data-theme' => 'dark']) !!}
```

Invisible reCAPTCHA using a [submit\_button](https://developers.google.com/recaptcha/docs/invisible):

```
{!! NoCaptcha::displaySubmit('my-form-id', 'submit now!', ['data-theme' => 'dark']) !!}

Notice that the id of the form is required in this method to let the autogenerated callback submit the form on a successful captcha verification.

### Validation

Add `'g-recaptcha-response' => 'required|captcha'` to rules array:
```php
$validate = Validator::make(Input::all(), [
    'g-recaptcha-response' => 'required|captcha'
]);
```

### Custom Validation Message

[](#custom-validation-message)

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

```
'custom' => [
    'g-recaptcha-response' => [
        'required' => 'Please verify that you are not a robot.',
        'captcha' => 'Captcha error! Try again later or contact site admin.',
],
],
```

Then check for captcha errors in the `Form`:

```
@if ($errors->has('g-recaptcha-response'))

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

@endif
```

Testing
-------

[](#testing)

When using the [Laravel Testing functionality](https://laravel.com/docs/12/testing), you will need to mock out the response for the captcha form element.

So for any form tests involving the captcha, you can do this by mocking the facade behavior:

```
// prevent validation error on captcha
NoCaptcha::shouldReceive('verifyResponse')
    ->once()
    ->andReturn(true);

// provide hidden input for your 'required' validation
NoCaptcha::shouldReceive('display')
    ->zeroOrMoreTimes()
    ->andReturn('');
```

You can then test the remainder of your form as normal.

When using HTTP tests you can add the `g-recaptcha-response` to the request body for the 'required' validation:

```
// prevent validation error on captcha
NoCaptcha::shouldReceive('verifyResponse')
    ->once()
    ->andReturn(true);

// POST request, with request body including g-recaptcha-response
$response = $this->json('POST', '/register', [
    'g-recaptcha-response' => '1',
    'name' => 'John Doe',
    'email' => 'john@doe.com',
    'password' => 'password',
    'password_confirmation' => 'password',
]);
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Vasileios Ntoufoudis](https://github.com/ntoufoudis)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance54

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

4

Last Release

315d ago

Major Versions

0.3 → 1.0.02025-08-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a0e4562d814e61aaa5dc698cc667c6d6c90c98516142b60c0924b337c418355?d=identicon)[ntoufoudis](/maintainers/ntoufoudis)

---

Top Contributors

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

---

Tags

captchacaptcha-recaptchalaravelphplaravelrecaptchacaptchano-captcha

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ntoufoudis-no-captcha/health.svg)

```
[![Health](https://phpackages.com/badges/ntoufoudis-no-captcha/health.svg)](https://phpackages.com/packages/ntoufoudis-no-captcha)
```

###  Alternatives

[anhskohbo/no-captcha

No CAPTCHA reCAPTCHA For Laravel.

1.8k9.0M33](/packages/anhskohbo-no-captcha)[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2701.9M2](/packages/josiasmontag-laravel-recaptchav3)

PHPackages © 2026

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