1. Go to this page and download the library: Download mcnub/nextcaptcha-laravel 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/ */
mcnub / nextcaptcha-laravel example snippets
use NextCaptcha\Facades\NextCaptcha;
// Solve reCAPTCHA v2
$result = NextCaptcha::recaptchaV2(
websiteUrl: 'https://example.com',
websiteKey: 'site-key'
);
// Get balance
$balance = NextCaptcha::getBalance();
use NextCaptcha\NextCaptchaAPI;
class CaptchaController extends Controller
{
public function __construct(
private NextCaptchaAPI $captcha
) {}
public function solve()
{
$result = $this->captcha->recaptchaV2(
websiteUrl: 'https://example.com',
websiteKey: 'site-key'
);
return response()->json($result);
}
}