---
title: "How to Integrate Google reCAPTCHA with Laravel?"
url: "https://magecomp.com/blog/integrate-google-recaptcha-with-laravel/"
date: "2024-03-13T15:14:56+00:00"
modified: "2025-01-06T06:30:20+00:00"
author:
  name: "Bharat Desai"
  url: "https://magecomp.com"
categories:
  - "Laravel"
word_count: 496
reading_time: "3 min read"
summary: "Hello Laravel Friends,"
description: "Enhance your Laravel application’s security with Google reCAPTCHA. Learn How to Integrate Google reCAPTCHA with Laravel"
keywords: "Laravel"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Perform Laravel Authentication with Breeze"
    url: "https://magecomp.com/blog/laravel-authentication-with-breeze/"
  - title: "Laravel 10: Custom User Registration &#038; Login Tutorial"
    url: "https://magecomp.com/blog/laravel-10-custom-user-registration-login/"
  - title: "How to Implement API Versioning in Laravel"
    url: "https://magecomp.com/blog/implement-api-versioning-laravel/"
---

# How to Integrate Google reCAPTCHA with Laravel?

_Published: March 13, 2024_  
_Author: Bharat Desai_  

![How to Integrate Google reCAPTCHA with Laravel](https://magecomp.com/blog/wp-content/uploads/2024/03/How-to-Integrate-Google-reCAPTCHA-with-Laravel-1024x512.webp)

**Hello Laravel Friends,**

With web applications becoming more and more common, keeping them secure has never been more important then it is today. As malicious bots and automated attacks rise, developers are required to develop strong solutions to keep their systems and also protect users’ data. A well known solution to this problem is Google reCAPTCHA, a service widely used to determine whether it is human traffic or automations. In this blog post, I’ll share how you can add reCAPTCHA to your Laravel application to secure the application from unauthorized access.
[![Laravel Development Services](https://magecomp.com/blog/wp-content/uploads/2024/12/Laravel-Development-Services-4.webp)](https://magecomp.com/services/laravel-development-services/)

## What is Google reCAPTCHA?
Google provides free service called reCAPTCHA that serves as an extra security over your web forms and login pages. To ensure that it can only be solved by humans, it poses challenges to users — like identifying images, or solving puzzles — to figure them out. But through use of reCAPTCHA, developers can nearly eliminate the risk of spam submissions, brute-force attacks, and various other malicious attacks.
## Getting Started
Before integrating reCAPTCHA into our Laravel application, we need to obtain API keys from Google. Follow these steps to get your reCAPTCHA keys:
**Sign up for reCAPTCHA:**

Visit the [**Google reCAPTCHA website**](https://www.google.com/recaptcha/admin/create) and sign up for an account if you haven’t already done so.
**Register your site:**

After signing in, register your website or application to obtain your Google reCAPTCHA Site Key and Secret Key.
Check out the [**step-by-step guide to get the Google reCAPTCHA Site Key and Secret Key**](https://magecomp.com/blog/get-the-google-recaptcha-site-key-and-secret-key/).
## Integrating Google reCAPTCHA in Laravel
Now that we have our reCAPTCHA keys, let’s proceed with integrating it into our Laravel application.
### [![Hire laravel Developer](https://magecomp.com/blog/wp-content/uploads/2024/12/Hire-Laravel-Expert-Now-3.webp)](https://magecomp.com/services/hire-laravel-developer/)

### Step 1: Install the Google reCAPTCHA package
We’ll use the “anhskohbo/no-captcha” package to integrate reCAPTCHA into our Laravel application. Install the package via Composer:
```
composer require anhskohbo/no-captcha
```

### Step 2: Add reCAPTCHA keys to the environment configuration
Open your **.env file** and add your reCAPTCHA Site Key and Secret Key:
```
NOCAPTCHA_SITEKEY=your-site-key
NOCAPTCHA_SECRET=your-secret-key
```

### Step 3: Add reCAPTCHA to your forms
Add reCAPTCHA to your forms by including the reCAPTCHA widget and verifying the user’s response in your controller.
Example Form:
```
<form action="/submit-form" method="POST">
    @csrf
    {!! NoCaptcha::renderJs() !!}
    {!! NoCaptcha::display() !!}
    <button type="submit">Submit</button>
</form>
```

Example Controller:
```
use IlluminateHttpRequest;

public function submitForm(Request $request)
{
    $request->validate([
        'g-recaptcha-response' => 'required|captcha',
        // Add your other form validation rules here
    ]);

    // Process the form submission
}
```

## Conclusion:
Implementing reCAPTCHA in your Laravel application is a simple yet effective way to enhance security and protect against automated attacks. By following the steps outlined in this blog post, you can easily integrate reCAPTCHA into your forms and significantly reduce the risk of spam and abuse. Remember to keep your reCAPTCHA keys secure and regularly monitor your application’s security to ensure continued protection against threats. With reCAPTCHA in place, you can provide a safer and more secure experience for your users.
[![Contact Us](https://magecomp.com/blog/wp-content/uploads/2024/12/Contact-Us-3.webp)](https://magecomp.com/contact)

Apart from Laravel application, you can [**enable reCAPTCHA for Magento store**](https://magecomp.com/magento-2-google-recaptcha.html) and [**Shopify store**](https://magecomp.com/blog/enable-or-disable-google-recaptcha-in-shopify/).
**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/integrate-google-recaptcha-with-laravel/](https://magecomp.com/blog/integrate-google-recaptcha-with-laravel/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-09-08 11:23:34 UTC_  
