Download the PHP package rvxlab/hcaptcha without Composer
On this page you can find all versions of the php package rvxlab/hcaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hcaptcha
Laravel HCaptcha
A package to easily include HCaptcha in Laravel.
This project is originally based on laravel-reCAPTCHA and forked from Scyllaly, who seemingly abandoned the project.
This fork is a near-drop-in replacement for Scyllaly's package, maintaining the same namespace for 4.x and 5.x versions.
Requirements
Laravel version | Minimum PHP version |
---|---|
8.x | 7.4 |
9.x | 8.0 |
10.x | 8.1 |
11.x | 8.2 |
Need support for Laravel 7 or before? Check the 4.x branch.
Installation
Install the package with Composer:
Publish the config file:
Optionally publish the translations:
Optionally publish the views:
Configuration
Add HCAPTCHA_SECRET
and HCAPTCHA_SITEKEY
in .env file :
You can obtain them from your HCaptcha dashboard.
Usage
Prepare the script
First you need to initialize the script:
You can optionally set the locale and the custom callback function:
You can also use the app locale if you have a multilingual application:
Render the widget
This package provides support for the regular widget, as well as the invisible captcha.
Initialize the regular widget:
Any attributes can be passed as an array to the display
method or as properties on the Blade component:
Invisible widget
If you rather want forms to have an invisible widget:
If you have a custom callback defined for your forms you can define a data-callback
attribute:
Validation
Add 'h-captcha-response' => 'required|HCaptcha'
to the rules array:
Testing
You can mock the HCaptcha validation by calling the shouldReceive
method on the HCaptcha
facade:
Or when testing a JSON call:
Upgrading
Check the Upgrade Guide for notes on updating from 4.x to 5.x.
License
This package is licensed under MIT.
All versions of hcaptcha with dependencies
ext-json Version *
illuminate/support Version ^8.28 || ^9.0 || ^10.0 || ^11.0
guzzlehttp/guzzle Version ^7.4