1. Go to this page and download the library: Download mcaskill/charcoal-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/ */
mcaskill / charcoal-recaptcha example snippets
use Charcoal\ReCaptcha\Captcha;
$captcha = new Captcha([
'config' => [
'public_key' => '…',
'private_key' => '…',
]
]);
// As middleware
$app->post('/signup', '…')->add($captcha);
// As standalone, with direct user input
$captcha->verify($input, $ip);
// With a PSR-7 request
$captcha->verifyRequest($request);
// Display the widget in your views
echo $captcha->display(
[
'data-theme' => 'dark',
'data-type' => 'audio',
],
[
'hl' => 'fr'
]
);
use Charcoal\ReCaptcha\Captcha;
use MyApp\ MyCustomReCaptcha;
$captcha = new Captcha([
'config' => [
'public_key' => '…',
'private_key' => '…',
],
'client_class' => MyCustomReCaptcha::class
]);
use Charcoal\ReCaptcha\Captcha;
use ReCaptcha\ReCaptcha;
use ReCaptcha\RequestMethod\CurlPost;
$client = new ReCaptcha('…', new CurlPost());
$captcha = new Captcha([
'config' => [
'public_key' => '…',
'private_key' => '…',
],
'client' => $client
]);