PHP code example of esyede / hcaptcha-laravel

1. Go to this page and download the library: Download esyede/hcaptcha-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

esyede / hcaptcha-laravel example snippets


$request->validate([
    'h-captcha-response' => ['hcaptcha'],
]);

'custom' => [
    'h-captcha-response' => [
        'hcaptcha' => 'Please verify that you are human.',
    ]
],



syede\Laravel\HCaptcha\HCaptcha;

$sitekey = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX';
$secret = '0x0000000000000000000000000000000000000000';
$guzzleOptions = [
    // 'verify' => false,
];
$hCaptcha = new HCaptcha($sitekey, $secret, $guzzleOptions);

if (!empty($_POST)) {
    var_dump($hCaptcha->validate($_POST['h-captcha-response']));
    exit;
}

sh
php artisan vendor:publish --provider="Esyede\Laravel\HCaptcha\HCaptchaServiceProvider"
blade
{!! HCaptcha::display() !!}
blade
{!! HCaptcha::display([
    'class' => $errors->has('email') ? 'is-invalid' : '',
]) !!}
blade
{!! HCaptcha::script($locale, $render, $onload, $recaptchacompat) !!}