This Composer package adds Google reCAPTCHA display, JavaScript helpers, and validation rules to Laravel applications. It supports visible and invisible widgets with configurable themes.
Overview
No CAPTCHA reCAPTCHA is a Laravel package that wires Google reCAPTCHA into PHP web applications. Install it with Composer and register the service provider and facade on older Laravel versions; Laravel 5.5 and above can use package auto-discovery.
Configuration uses NOCAPTCHA_SECRET and NOCAPTCHA_SITEKEY environment variables for keys obtained from Google. Blade helpers render the JavaScript source, display default or customized widgets, and support invisible challenges bound to a form submit button with a required form id.
Server-side validation adds a captcha rule alongside required on the g-recaptcha-response field, with optional custom validation messages in language files. During Laravel tests you can mock the facade and include g-recaptcha-response in HTTP test payloads.
A short non-Laravel PHP example shows verifying posted responses with the same library. The package depends on PHP, Guzzle, and illuminate/support across many Laravel major versions.
Key features
- Laravel service provider integration
- Blade JS and widget helpers
- Visible and invisible widgets
- Theme and callback attributes
- captcha validation rule
- Test facade mocking helpers
- Composer package distribution
- Standalone PHP verify example
Use cases
- Bot protection on Laravel forms
- Registration and login challenges
- Invisible reCAPTCHA submit buttons
- Localized captcha error messages
- Automated form tests with mocks