PHP code example of victor-prdh / recaptcha-bundle

1. Go to this page and download the library: Download victor-prdh/recaptcha-bundle 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/ */

    

victor-prdh / recaptcha-bundle example snippets

 
//config/bunldes.php

return [
    ...
    VictorPrdh\RecaptchaBundle\RecaptchaBundle::class => ['all' => true]
];



namespace App\Form;

use VictorPrdh\RecaptchaBundle\Form\ReCaptchaType;

class TaskType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add("recaptcha", ReCaptchaType::class);

        // If you want an "invisible" recaptcha protection use this:
        // $builder->add("recaptcha", ReCaptchaType::class, ["type" => "invisible"]);
    }
}
env
###> victor-prdh/recaptcha ###
# https://www.google.com/recaptcha/admin  <--- get keys here
GOOGLE_RECAPTCHA_SITE_KEY='your site key'
GOOGLE_RECAPTCHA_SECRET_KEY='your secret key'
###< victor-prdh/recaptcha ###