There is no license information available for the latest version (v1.0.1) of this package.

v1.0.1 2023-04-05 14:12 UTC

This package is auto-updated.

Last update: 2024-07-05 16:52:06 UTC


Lumberjack ReCAPTCHA

This package provides a simple integration for ReCAPTCHA v2 with Lumberjack and the lumberjack-validation package.


composer require rareloop/lumberjack-recaptcha

Once installed, register the Service Provider in config/app.php:

'providers' => [



Copy the example config/recaptcha.php file to you theme directory.

Add your ReCAPTCHA credentials to your .env file:


# Optional, if you need to specify the hostname directly


Make sure you call the recaptcha() Twig function in the form that you wish to add support to:

<form method="" action="">
    <input name="my-input-name" type="text">
    {{ recaptcha() }}
    <button type-"submit">Submit</button>

And then add the validation to your Form class to ensure that it is checked:


namespace App\Http\Forms;

use Rareloop\Lumberjack\Validation\AbstractForm;

class ContactForm extends AbstractForm
     * The validation rules for this form
     * @type {Array}
    protected $rules = [
        'my-input-name' => 'required',
        'g-recaptcha-response' => ['required', 'recaptcha'],

Showing an error

You may also want to show an error if the ReCAPTCHA fails for some reason. Assuming you're passing the standard errors array into your view you can simply check for the presence of the g-recaptcha-response key:

<form method="" action="">
    <input name="my-input-name" type="text">
    {{ recaptcha() }}
    {% if errors['g-recaptcha-response'] %}
        {% for error in errors['g-recaptcha-response'] %}
            <p class="error">{{ error }}</p>
        {% endfor %}
    {% endif %}
    <button type-"submit">Submit</button>