PHP code example of timehunter / laravel-google-recaptcha-v2

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

    

timehunter / laravel-google-recaptcha-v2 example snippets

 php
'providers'=[
    ....,
    TimeHunter\LaravelGoogleReCaptchaV2\Providers\GoogleReCaptchaV2ServiceProvider::class
]
 php
'aliases'=[
     ....,
     'GoogleReCaptchaV2'=> TimeHunter\LaravelGoogleReCaptchaV2\Facades\GoogleReCaptchaV2::class
 ]
 PHP  
 {!!  GoogleReCaptchaV2::render('form_id_1','form_id_2') !!}
 PHP
    [
        ...
        'badge' => 'bottomright'
        ...
    ]
 php
   GoogleReCaptchaV2::verifyResponse($value, $ip=null);
 php
   GoogleReCaptchaV2::verifyResponse($value,$ip)->getMessage();
   GoogleReCaptchaV2::verifyResponse($value)->isSuccess();
   GoogleReCaptchaV2::verifyResponse($value)->toArray();
 php
    public function verify(Request $request)
    {
        dd(GoogleReCaptchaV2::verifyResponse($request->input('g-recaptcha-response'))->getMessage());
    }
    public function index(Request $request)
    {
        return view('index');    
   }
 PHP
    [
        ...
        'template' => 'test.template'
        ...
    ]
 php
     $this->app->bind(
                ReCaptchaConfigV2Interface::class,
                YourOwnCustomImplementation::class
            );
 php
     $this->app->bind(
                RequestClientInterface::class,
                YourOwnCustomImplementation::class
            );