PHPackages                             kupidonkhv/captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. kupidonkhv/captcha

ActivePackage[Validation &amp; Sanitization](/categories/validation)

kupidonkhv/captcha
==================

Laravel 12 Captcha Package FORK

v3.5.0(8mo ago)011MITPHPPHP ^7.2|^8.1|^8.2|^8.3

Since Sep 16Pushed 8mo agoCompare

[ Source](https://github.com/kupidonkhv/captcha)[ Packagist](https://packagist.org/packages/kupidonkhv/captcha)[ Docs](https://github.com/kupidonkhv/captcha)[ RSS](/packages/kupidonkhv-captcha/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

Captcha for Laravel 5/6/7/8/9/10/11/12
======================================

[](#captcha-for-laravel-56789101112)

[![Latest Stable Version](https://camo.githubusercontent.com/6e427d9afc6adcf3730459c4446bb733a4117cd006c929b7a342064aa6559bb7/68747470733a2f2f706f7365722e707567782e6f72672f6b757069646f6e6b68762f636170746368612f762f737461626c652e737667)](https://packagist.org/packages/kupidonkhv/captcha)[![Latest Unstable Version](https://camo.githubusercontent.com/23993fac4c91689d9c558ba3a74ef16699f1900e1fb14cdf06fc621b6cf00c14/68747470733a2f2f706f7365722e707567782e6f72672f6b757069646f6e6b68762f636170746368612f762f756e737461626c652e737667)](https://packagist.org/packages/kupidonkhv/captcha)[![License](https://camo.githubusercontent.com/e550ed3786dc60b7378e76ea2ed330d327f8c86e91bd7ba9a9db21a45620ea55/68747470733a2f2f706f7365722e707567782e6f72672f6b757069646f6e6b68762f636170746368612f6c6963656e73652e737667)](https://packagist.org/packages/kupidonkhv/captcha)[![Total Downloads](https://camo.githubusercontent.com/c4f4f8558374215574cf71d064b95dd58740e5dedb8282a45ada645222f4bb5f/68747470733a2f2f706f7365722e707567782e6f72672f6b757069646f6e6b68762f636170746368612f646f776e6c6f6164732e737667)](https://packagist.org/packages/kupidonkhv/captcha)

A simple [Laravel 5/6/7/8/9/10/11/12](http://www.laravel.com/) service provider for including the Captcha package with full Laravel 12 support.

for Laravel 4 [Captcha for Laravel Laravel 4](https://github.com/mewebstudio/captcha/tree/master-l4)

for Laravel 5 to 12 [Captcha for Laravel Laravel 5 and Newer versions](https://github.com/mewebstudio/captcha/tree/master-l5-l9)

Preview
-------

[](#preview)

[![Preview](https://camo.githubusercontent.com/5796b984677c086025788097a4f9f89701595234cb98a23c7276c4ea5424c6ef/68747470733a2f2f696d6167652e6962622e636f2f6b5a784d4c6d2f696d6167652e706e67)](https://camo.githubusercontent.com/5796b984677c086025788097a4f9f89701595234cb98a23c7276c4ea5424c6ef/68747470733a2f2f696d6167652e6962622e636f2f6b5a784d4c6d2f696d6167652e706e67)

- [Captcha for Laravel 5/6/7/8/9/10/11/12](#captcha-for-laravel-5-6-7)
    - [Preview](#preview)
    - [Installation](#installation)
    - [Usage](#usage)
    - [Configuration](#configuration)
        - [Custom settings:](#custom-settings)
        - [Disable validation:](#disable-validation)
    - [Example Usage](#example-usage)
        - [Session Mode:](#session-mode)
        - [Stateless Mode:](#stateless-mode)
- [Return Image](#return-image)
- [Return URL](#return-url)
- [Return HTML](#return-html)
- [To use different configurations](#to-use-different-configurations)
    - [Links](#links)

Installation
------------

[](#installation)

The Captcha Service Provider can be installed via [Composer](http://getcomposer.org) by requiring the `kupidonkhv/captcha` package:

```
{
    "require": {
        "kupidonkhv/captcha": "^3.5"
    }
}
```

or

Require this package with composer:

```
composer require kupidonkhv/captcha

```

Update your packages with `composer update` or install with `composer install`.

In Windows, you'll need to include the GD2 DLL `php_gd2.dll` in php.ini. And you also need include `php_fileinfo.dll` and `php_mbstring.dll` to fit the requirements of `kupidonkhv/captcha`'s dependencies.

Usage
-----

[](#usage)

To use the Captcha Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this.

Find the `providers` key in `config/app.php` and register the Captcha Service Provider.

```
    'providers' => [
        // ...
        'Mews\Captcha\CaptchaServiceProvider',
    ]
```

for Laravel 5.1+

```
    'providers' => [
        // ...
        Mews\Captcha\CaptchaServiceProvider::class,
    ]
```

For Laravel 11+ you can add the provider to `bootstrap\providers.php`.

```
return [
    // ...
    Mews\Captcha\CaptchaServiceProvider::class
];
```

Find the `aliases` key in `config/app.php`.

```
    'aliases' => [
        // ...
        'Captcha' => 'Mews\Captcha\Facades\Captcha',
    ]
```

for Laravel 5.1+

```
    'aliases' => [
        // ...
        'Captcha' => Mews\Captcha\Facades\Captcha::class,
    ]
```

For Laravel 11+ : you do not need to add the alias, it will be added automatically.

Configuration
-------------

[](#configuration)

### Custom settings:

[](#custom-settings)

To use your own settings, publish config.

`$ php artisan vendor:publish --provider="Mews\Captcha\CaptchaServiceProvider"`

`config/captcha.php`

```
return [
    'default'   => [
        'length'    => 5,
        'width'     => 120,
        'height'    => 36,
        'quality'   => 90,
        'math'      => true,  //Enable Math Captcha
        'expire'    => 60,    //Captcha expiration
    ],
    // ...
];
```

### Disable validation:

[](#disable-validation)

To disable the captcha validation use `CAPTCHA_DISABLE` environment variable. e.g. **.env** config:

```
CAPTCHA_DISABLE=true
```

Example Usage
-------------

[](#example-usage)

### Session Mode:

[](#session-mode)

```
    // [your site path]/Http/routes.php
    Route::any('captcha-test', function() {
        if (request()->getMethod() == 'POST') {
            $rules = ['captcha' => 'required|captcha'];
            $validator = validator()->make(request()->all(), $rules);
            if ($validator->fails()) {
                echo 'Incorrect!';
            } else {
                echo 'Matched :)';
            }
        }

        $form = '';
        $form .= '';
        $form .= '' . captcha_img() . '';
        $form .= '';
        $form .= 'Check';
        $form .= '';
        return $form;
    });
```

Detailed Example in Laravel way view files

```
    //register.blade.php

         @error('captcha')
         {{ $message }} @enderror
```

controller files

```
        Validator::make($input, [
            'name' => ['required', 'string', 'max:255'],
            'email' => [
                'required',
                'string',
                'email',
                'max:255',
                Rule::unique(User::class),
            ],
            'password' => $this->passwordRules(),
            'captcha' => 'required|captcha'
        ])->validate();
```

### Stateless Mode:

[](#stateless-mode)

You get key and img from this url `http://localhost/captcha/api/math`and verify the captcha using this method:

```
    //key is the one that you got from json response
    // fix validator
    // $rules = ['captcha' => 'required|captcha_api:'. request('key')];
    $rules = ['captcha' => 'required|captcha_api:'. request('key') . ',math'];
    $validator = validator()->make(request()->all(), $rules);
    if ($validator->fails()) {
        return response()->json([
            'message' => 'invalid captcha',
        ]);

    } else {
        //do the job
    }
```

Return Image
============

[](#return-image)

```
captcha();
```

or

```
Captcha::create();
```

Return URL
==========

[](#return-url)

```
captcha_src();
```

or

```
Captcha::src('default');

```

Return HTML
===========

[](#return-html)

```
captcha_img();
```

or

```
Captcha::img();
```

To use different configurations
===============================

[](#to-use-different-configurations)

```
captcha_img('flat');

Captcha::img('inverse');
```

etc.

Based on [Intervention Image](https://github.com/Intervention/image)

^\_^

Links
-----

[](#links)

- [Intervention Image](https://github.com/Intervention/image)
- [L5 Captcha on Github](https://github.com/mewebstudio/captcha)
- [L5 Captcha on Packagist](https://packagist.org/packages/mews/captcha)
- [For L4 on Github](https://github.com/mewebstudio/captcha/tree/master-l4)
- [License](http://www.opensource.org/licenses/mit-license.php)
- [Laravel website](http://laravel.com)
- [Laravel Turkiye website](http://www.laravel.gen.tr)
- [mewebstudio](https://github.com/mewebstudio/captcha)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance61

Regular maintenance activity

Popularity6

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 59.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b914d8abb1a749e4177e982d98edad4cf9d76fa6625524fcfc71989ed6915adc?d=identicon)[kupidonkhv](/maintainers/kupidonkhv)

---

Top Contributors

[![mewebstudio](https://avatars.githubusercontent.com/u/2125733?v=4)](https://github.com/mewebstudio "mewebstudio (159 commits)")[![mauris](https://avatars.githubusercontent.com/u/996939?v=4)](https://github.com/mauris "mauris (33 commits)")[![jcanchor](https://avatars.githubusercontent.com/u/16929759?v=4)](https://github.com/jcanchor "jcanchor (11 commits)")[![mwllgr](https://avatars.githubusercontent.com/u/25794895?v=4)](https://github.com/mwllgr "mwllgr (10 commits)")[![sineld](https://avatars.githubusercontent.com/u/445349?v=4)](https://github.com/sineld "sineld (7 commits)")[![saidbakr](https://avatars.githubusercontent.com/u/467554?v=4)](https://github.com/saidbakr "saidbakr (5 commits)")[![hutushen222](https://avatars.githubusercontent.com/u/352215?v=4)](https://github.com/hutushen222 "hutushen222 (3 commits)")[![Sergej-Tihonov](https://avatars.githubusercontent.com/u/15265981?v=4)](https://github.com/Sergej-Tihonov "Sergej-Tihonov (3 commits)")[![jxlwqq](https://avatars.githubusercontent.com/u/2421068?v=4)](https://github.com/jxlwqq "jxlwqq (3 commits)")[![khalilst](https://avatars.githubusercontent.com/u/9103966?v=4)](https://github.com/khalilst "khalilst (3 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![profkevinbrowne](https://avatars.githubusercontent.com/u/67722209?v=4)](https://github.com/profkevinbrowne "profkevinbrowne (2 commits)")[![kupidonkhv](https://avatars.githubusercontent.com/u/14288530?v=4)](https://github.com/kupidonkhv "kupidonkhv (2 commits)")[![Assmay](https://avatars.githubusercontent.com/u/18699209?v=4)](https://github.com/Assmay "Assmay (2 commits)")[![farzinghanbari](https://avatars.githubusercontent.com/u/14145192?v=4)](https://github.com/farzinghanbari "farzinghanbari (2 commits)")[![masoodvahid](https://avatars.githubusercontent.com/u/15362786?v=4)](https://github.com/masoodvahid "masoodvahid (2 commits)")[![teksite](https://avatars.githubusercontent.com/u/149485086?v=4)](https://github.com/teksite "teksite (2 commits)")[![jp7anderson](https://avatars.githubusercontent.com/u/9416588?v=4)](https://github.com/jp7anderson "jp7anderson (2 commits)")[![ithsjeff](https://avatars.githubusercontent.com/u/160572359?v=4)](https://github.com/ithsjeff "ithsjeff (2 commits)")[![ycrao](https://avatars.githubusercontent.com/u/3280204?v=4)](https://github.com/ycrao "ycrao (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kupidonkhv-captcha/health.svg)

```
[![Health](https://phpackages.com/badges/kupidonkhv-captcha/health.svg)](https://phpackages.com/packages/kupidonkhv-captcha)
```

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[bayareawebpro/laravel-multistep-forms

Responsable MultiStep Form Builder for Laravel.

967.9k](/packages/bayareawebpro-laravel-multistep-forms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
