spaanproductions/laravel-google-recaptcha-enterprise

This is my package laravel-google-recaptcha-enterprise

v1.0.0 2025-02-24 14:38 UTC

This package is auto-updated.

Last update: 2025-02-24 14:58:10 UTC


README

Latest Version on Packagist Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require spaanproductions/laravel-google-recaptcha-enterprise

You can publish the config file with:

php artisan vendor:publish --tag="laravel-google-recaptcha-enterprise-config"

Optionally, you can publish the views using

php artisan vendor:publish --tag="laravel-google-recaptcha-enterprise-views"

Usage

Create a recaptcha key in the Google Console: https://console.cloud.google.com/security/recaptcha

Create a Service Account in the same project with the role: reCAPTCHA Enterprise Agent via: https://console.cloud.google.com/iam-admin/serviceaccounts

Than add an key with the JSON type in that service account. And add the credentials from that JSON in your .env:

# Google Recaptcha (enterprise)
GOOGLE_RECAPTCHA_SITEKEY="<recaptcha_id>"
GOOGLE_RECAPTCHA_PROJECT_ID="<project_id>"
RECAPTCHA_ENTERPRISE_PRIVATE_KEY_ID="<private_key_id>"
RECAPTCHA_ENTERPRISE_PRIVATE_KEY="<private_key>"
RECAPTCHA_ENTERPRISE_CLIENT_EMAIL="<client_email>"
RECAPTCHA_ENTERPRISE_CLIENT_ID="<client_id>"

# Optional
GOOGLE_RECAPTCHA_SCORE_THRESHOLD=0.7

Add the Captcha Scripts tot the <head> of the page

<head>
@captchaScripts()
</head>

Use the recaptcha button instead of the submit button

<x-recaptcha-submit-button class="custom-classes">
    Submit
</x-recaptcha-submit-button>

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.