PHP code example of huangdijia / laravel-recaptcha-v3

1. Go to this page and download the library: Download huangdijia/laravel-recaptcha-v3 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/ */

    

huangdijia / laravel-recaptcha-v3 example snippets


// default
@recaptcha_field()

// custom
@recaptcha_field(['site_key'=>'your_key', 'name'=>'input_name'])

// default
@recaptcha_initjs()

// custom
@recaptcha_initjs(['site_key'=>'your_key', 'action' => 'action_name', 'name'=>'input_name'])

Validator::make($request->all(), [
    'g-recaptcha-response' => ']);

    $routeMiddleware = [
        // ...
        'recaptcha' => Huangdijia\Recaptcha\Middleware\ReCaptcha::class,
    ];

Route::get('/path')->middleware('recaptcha');
Route::get('/path')->middleware('recaptcha:{ACTION},{SCORE},{HOSTNAME}');
bash
php artisan vendor:publish --provider="Huangdijia\Recaptcha\RecaptchaServiceProvider" --tag=config