PHP code example of los / losrecaptcha
1. Go to this page and download the library: Download los/losrecaptcha 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/ */
los / losrecaptcha example snippets
$this->add([
'name' => 'captcha',
'type' => 'captcha',
'options' => [
'captcha' => new LosReCaptcha\Captcha\ReCaptcha([
'site_key' => $siteKey,
'secret_key' => $siteSecret,
]),
],
]);
// ...
$this->add([
'name' => 'captcha',
'type' => 'captcha',
'options' => [
'captcha' => new \LosReCaptcha\Captcha\Invisible([
'site_key' => $siteKey,
'secret_key' => $siteSecret,
'callback' => 'captchaSubmit', // Callback to submit the form
'button_id' => 'submit-button', // Button id to submit the form
]),
],
]);
// ...
$this->add([
'name' => 'submit-button',
'type' => \Zend\Form\Element\Button::class,
'options' => [
'label' => _('Log In'),
],
'attributes' => [
'id' => 'submit-button',
'class' => 'btn btn-block btn-primary',
'value' => _('Log In'),
],
]);
// ...
$aggregator = new ConfigAggregator([
// ...
\LosReCaptcha\ConfigProvider::class,
// ...
], $cacheConfig['config_cache_path']);
return $aggregator->getMergedConfig();