PHP code example of lukaschel / pimcore-recaptcha

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

    

lukaschel / pimcore-recaptcha example snippets


public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('g_recaptcha_response', HiddenType::class, [
            'attr' => [
                'class' => 'g-recaptcha-response-input'
            ]
        ]);
}

if ($form->isSubmitted() &&
    $form->isValid() &&
    $this->container->get('lukaschel.recaptcha')->validate($request->request->get('FORM_NAME')['g_recaptcha_response'])
    ) {
    ...
}