Download the PHP package dutchcodingcompany/livewire-recaptcha without Composer

On this page you can find all versions of the php package dutchcodingcompany/livewire-recaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package livewire-recaptcha

Livewire ReCAPTCHA v3/v2/v2-invisible

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status GitHub PHPStan Action Status Total Downloads

This package provides a custom Livewire directive to protect your Livewire functions with a Google reCAPTCHA (v2 + v2 invisible + v3) check.

Installation

Configuration

Read https://developers.google.com/recaptcha/intro on how to create your own key pair for the specific ReCaptcha version you are going to implement.

This package supports the following versions. Note that each version requires a different sitekey/secretkey pair:

Version Docs Notes
v3 (recommended) V3 Docs
v2 V2 Docs
v2 invisible V2 Docs Use 'size' => 'invisible'

Your options should reside in the config/services.php file:

Component

In your Livewire component, at your form submission method, add the #[ValidatesRecaptcha] attribute:

For fine-grained control, you can pass a custom secret key and minimum score (applies only to V3) using:

View

On the view side, you have to include the Blade directive @livewireRecaptcha. This adds two scripts to the page, one for the reCAPTCHA script and one for the custom Livewire directive to hook into the form submission.

Preferrably these scripts are only added to the page that has the Captcha-protected form (alternatively, you can add the @livewireRecaptcha directive on a higher level, lets say your layout).

Secondly, add the new directive wire:recaptcha to the form element that you want to protect.

You can override any of the configuration values using:

Finishing up

The Google ReCAPTCHA validation will automatically occur before the actual form is submitted. Before the save() method is executed, a serverside request will be sent to Google to verify the Captcha challenge. Once the reCAPTCHA response has been successful, your actual Livewire component method will be executed.

Error handling

When an error occurs with the Captcha validation, a ValidationException is thrown for the key gRecaptchaResponse. There is a translatable error message available under 'livewire-recaptcha::recaptcha.invalid_response'.


All versions of livewire-recaptcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
livewire/livewire Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dutchcodingcompany/livewire-recaptcha contains the following files

Loading the files please wait ....