devwizardhq / wiz-captcha
This is my package wiz-captcha
Fund package maintenance!
0.0.2
2026-05-07 06:42 UTC
Requires
- php: ^8.2
- ext-gd: *
- illuminate/cache: ^11.0||^12.0||^13.0
- illuminate/contracts: ^11.0||^12.0||^13.0
- illuminate/routing: ^11.0||^12.0||^13.0
- illuminate/support: ^11.0||^12.0||^13.0
- illuminate/validation: ^11.0||^12.0||^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
README
Installation
You can install the package via composer:
composer require devwizardhq/wiz-captcha
You can publish the config file with:
php artisan vendor:publish --tag="wiz-captcha-config"
Usage
In View
<form method="POST" action="/contact"> @csrf {!! wiz_captcha_img('default', ['id' => 'captcha-image']) !!} <button type="button" onclick="refreshCaptcha()">Refresh</button> <input type="text" name="captcha" required autocomplete="off"> @error('captcha') <div>{{ $message }}</div> @enderror <button type="submit">Submit</button> </form> <script> function refreshCaptcha() { document.getElementById('captcha-image').src = "{{ route('wiz-captcha.image') }}?" + Date.now(); } </script>
Controller
use DevWizardHQ\Captcha\Rules\CaptchaRule; $request->validate([ 'captcha' => ['required', new CaptchaRule], ]);
String Rule
$request->validate([ 'captcha' => ['required', 'wiz_captcha'], ]);
API Rule
$captcha = wiz_captcha_api('math');
API Validation
use DevWizardHQ\Captcha\Rules\CaptchaApiRule; $request->validate([ 'captcha_key' => ['required', 'string'], 'captcha' => ['required', new CaptchaApiRule($request->captcha_key)], ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.