vovarpd/laravel-anticaptcha

Laravel implementation of anti-captcha.com API

v0.1.4 2019-02-25 13:53 UTC

This package is auto-updated.

Last update: 2024-12-26 02:40:06 UTC


README

Latest Stable Version Total Downloads License Scrutinizer Code Quality Build Status

This Laravel package based on:

https://github.com/AdminAnticaptcha/anticaptcha-php

Installation

Composer

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

Basic Usage:

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());
}