This Laravel package based on:
https://github.com/AdminAnticaptcha/anticaptcha-php
Run the command:
$ composer require vovarpd/laravel-anticaptcha
Or
Add laravel-anticaptcha in your composer.json or create a new composer.json:
{
"require": {
"vovarpd/laravel-anticaptcha": "^0.1"
}
}
Now tell composer to download the library by running the command:
$ php composer.phar install
Composer will generate the autoloader file automatically. So you only have to include this. Typically its located in the vendor dir and its called autoload.php
Then publish config file by running the command:
$ php artisan vendor:publish --tag=anticaptcha
Set API key in config/anticaptcha.php or .env file.
<?php
return [
'key'=>env('ANTICAPTCHA_API_KEY','')
];
Dependency Injection example.
use LaravelAnticaptcha\Anticaptcha\Exceptions\AnticaptchaException;
use LaravelAnticaptcha\Anticaptcha\NoCaptchaProxyless;
public function handle( NoCaptchaProxyless $no_captcha_proxyless ) {
$no_captcha_proxyless->setVerboseMode(false);
$no_captcha_proxyless->setWebsiteURL( 'https://targetdomain.com' );
$no_captcha_proxyless->setWebsiteKey( 'recaptcha_site_key' );
$no_captcha_proxyless->createTask();
$taskId = $no_captcha_proxyless->getTaskId();
$no_captcha_proxyless->waitForResult();
dump($no_captcha_proxyless->getTaskSolution());
}