devwizardhq/wiz-captcha

This is my package wiz-captcha

Maintainers

Package info

github.com/DevWizardHQ/wiz-captcha

Homepage

pkg:composer/devwizardhq/wiz-captcha

Fund package maintenance!

DevWizardHQ

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.2 2026-05-07 06:42 UTC

This package is auto-updated.

Last update: 2026-05-07 06:47:39 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.