PHP code example of timehunter / laravel-google-recaptcha-v3
1. Go to this page and download the library: Download timehunter/laravel-google-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/ */
timehunter / laravel-google-recaptcha-v3 example snippets php
'providers'=[
....,
TimeHunter\LaravelGoogleReCaptchaV3\Providers\GoogleReCaptchaV3ServiceProvider::class
]
php
'aliases'=[
....,
'GoogleReCaptchaV3'=> TimeHunter\LaravelGoogleReCaptchaV3\Facades\GoogleReCaptchaV3::class
]
php
'setting' = [
[
'action' => 'contact_us', // Google reCAPTCHA // if this is true, the system will do score comparsion against your threshold for the action
],
[
'action' => 'signup',
'threshold' => 0.2,
'score_comparison' => true
],
]
php
...
'is_score_enabled' = true
...
php
GoogleReCaptchaV3::setAction($action)->verifyResponse($value,$ip = null);
php
GoogleReCaptchaV3::verifyResponse($value,$ip)->getMessage();
GoogleReCaptchaV3::verifyResponse($value)->isSuccess();
GoogleReCaptchaV3::verifyResponse($value)->toArray();
php
GoogleReCaptchaV3::setAction($action)->verifyResponse($value)->isSuccess();
html
{!! GoogleReCaptchaV3::init([
'nonce' => nonce(),
]) !!}
GoogleReCaptchaV3::renderOne($id,$action);
{!! GoogleReCaptchaV3::renderOne('contact_us_id','contact_us') !!}
GoogleReCaptchaV3::renderField($id,$action,$class,$style)
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
html
<form method="POST" action="/verify">
{!! GoogleReCaptchaV3::renderField('contact_us_id','contact_us_action') !!}
<input type="submit" value="submit">
</form>
php
$this->app->bind(
ReCaptchaConfigV3Interface::class,
YourOwnCustomImplementation::class
);
php
$this->app->bind(
RequestClientInterface::class,
YourOwnCustomImplementation::class
);