Blog Detail


Set up & Validate Friendly Captcha & Response in Laravel App cover image

arrow_back Set up & Validate Friendly Captcha & Response in Laravel App

FriendlyCaptcha is a package that helps in setting up and validating the Friendly Captcha widget and response in your Laravel applications.


You can install the package via composer:

composer require ossycodes/friendlycaptcha




You can obtain your site-key from here and secret from here.


Include the FriendlyCaptcha widget scripts in your layout file using the @friendlyCaptchaRenderWidgetScripts Blade directive. This should be added to the head of your document.

        {{ $slot }}

or if you don’t want to use the Blade directive you can do this instead

 {!! FriendlyCaptcha::renderWidgetScripts() !!}

You have two options on how to add the script tag either from unpkg (default) or from jsdelivr

@friendlyCaptchaRenderWidgetScripts() or @friendlyCaptchaRenderWidgetScripts('jsdelivr')
{!! FriendlyCaptcha::renderWidgetScripts() !!} or {!! FriendlyCaptcha::renderWidgetScripts('jsdelivr') !!}

Once that’s done, you can call the renderWidget() method in form to output the appropriate markup (friendlycaptcha widget) with your site key configured.

<form action="/" method="POST">

    {!! FriendlyCaptcha::renderWidget() !!}

    or with custom theme

    {!! FriendlyCaptcha::renderWidget(['dark-theme' => true]) !!}

    or with custom language

    {!! FriendlyCaptcha::renderWidget(['data-lang' => 'en']) !!}


Finally, On the server, use the provided validation rule to validate the CAPTCHA response.

use Illuminate\Validation\Rule;

public function submit(Request $request)
        'frc-captcha-solution' => ['required', Rule::friendlycaptcha()],

For more details, please visit Github.


The team of Codebrisk Laravel developers is always ready to execute even your boldest ideas. Our expert team can design and develop any type of custom CRM solution, SAAS app, or e-commerce app to meet our customer’s needs and transform our customer’s experiences. Get in touch with our team to discuss your bespoke ideas and learn more about the next steps to launching cooperation.

Published at : 31-10-2022

Author : Rizwan Aslam
Rizwan Aslam

I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.

Launch your project

Launch project