arcaptcha/arcaptcha-laravel
Laravel integration for ArCaptcha (PHP 7.3+). Install via Composer, publish config, set ARCAPTCHA site/secret keys in .env, embed the widget in Blade forms, and verify the submitted token server-side using the provided service/facade.
Pros:
@arcaptchaScript, @arcaptchaWidget) streamline frontend implementation.Cons:
validation.php, adding minor localization overhead.mohammadv184/arcaptcha) would need custom Laravel wrappers.ARCAPTCHA_VERIFY_EXCEPTION_VALUE can be configured).arcaptcha validator assumes ArCaptcha’s API responses are consistent. Edge cases (e.g., malformed tokens, rate limits) may require custom handling.arcaptchaScript) may conflict with existing bundles (e.g., Vite/Webpack) or ad blockers.callback functions, risking namespace pollution in larger apps.ARCAPTCHA_VERIFY_EXCEPTION_VALUE is triggered (e.g., false positives/negatives)?validation.php setup?@arcaptchaScript and @arcaptchaWidget simplify frontend implementation without custom JavaScript.arcaptcha rule integrates with Laravel’s validator, enabling consistent form handling.defer or dynamic imports.curl or Postman.composer require arcaptcha/arcaptcha-laravel.php artisan vendor:publish --provider="Mohammadv184\ArCaptcha\Laravel\ArCaptchaServiceProvider"..env variables:
ARCAPTCHA_SITE_KEY=your_site_key
ARCAPTCHA_SECRET_KEY=your_secret_key
ARCAPTCHA_VERIFY_EXCEPTION_VALUE=false # Default fallback on API failure
resources/lang/[LANG]/validation.php:
'arcaptcha' => 'The :attribute verification failed. Please try again.',
config/app.php for shorter syntax.<!-- Head -->
@arcaptchaScript
<!-- Form -->
<form>
@csrf
@arcaptchaWidget(['lang' => 'en']) <!-- Optional: Pass widget options -->
<!-- Other fields -->
</form>
{!! ArCaptcha::getWidget(['size' => 'invisible', 'callback' => 'handleCaptcha']) !!}
<script>
function handleCaptcha(token) {
document.getElementById('arcaptcha-token').value = token;
// Or submit form automatically
}
</script>
$validator = Validator::make($request->all(), [
'arcaptcha-token' => 'required|arcaptcha',
]);
$mock = Mockery::mock('overload:Mohammadv184\ArCaptcha\Laravel\ArCaptcha');
$mock->shouldReceive('verify')->andReturn(true);
@arcaptchaScript outputs valid JS).How can I help you explore Laravel packages today?