PHPackages                             masoud5070/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. masoud5070/captcha

ActiveLibrary

masoud5070/captcha
==================

Laravel Captcha Package

3.3.1(7mo ago)02671MITPHPPHP ^7.2|^8.0|^8.1|^8.2

Since Jan 25Pushed 7mo agoCompare

[ Source](https://github.com/masoudtajer/captcha)[ Packagist](https://packagist.org/packages/masoud5070/captcha)[ RSS](/packages/masoud5070-captcha/feed)WikiDiscussions master Synced 3d ago

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

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

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

[![Build Status](https://camo.githubusercontent.com/059f66ef89e51b775dda5384be18537e707ef24cb8a469611b4d4d8bf1b09b7d/68747470733a2f2f7472617669732d63692e6f72672f6d6577656273747564696f2f636170746368612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mewebstudio/captcha) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/fa85500631c0dba36a80e40bc3ea1ef174f1cdd632d08dd47930edb7a01af1e5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6577656273747564696f2f636170746368612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mewebstudio/captcha/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/3b94dab914a4cf1aa4ed01eda49f21457fbdcf8c124598438e8d681c71049bb3/68747470733a2f2f706f7365722e707567782e6f72672f4d61736f7564353037302f636170746368612f762f737461626c652e737667)](https://packagist.org/packages/Masoud5070/captcha)[![Latest Unstable Version](https://camo.githubusercontent.com/aa99815af8f3c9c456c2117702eaa18b884d5450cf52ad08fba2250b3fd7e260/68747470733a2f2f706f7365722e707567782e6f72672f4d61736f7564353037302f636170746368612f762f756e737461626c652e737667)](https://packagist.org/packages/Masoud5070/captcha)[![License](https://camo.githubusercontent.com/65169ed3b29d5859e8a2fbcb84431bf3d7f93724b3b41f6264d2a60261ad27bf/68747470733a2f2f706f7365722e707567782e6f72672f4d61736f7564353037302f636170746368612f6c6963656e73652e737667)](https://packagist.org/packages/Masoud5070/captcha)[![Total Downloads](https://camo.githubusercontent.com/514f3b464acd1117cc106c68dbb9860827237d67530ab9733356e4a0883f9c9a/68747470733a2f2f706f7365722e707567782e6f72672f4d61736f7564353037302f636170746368612f646f776e6c6f6164732e737667)](https://packagist.org/packages/Masoud5070/captcha)

A simple [Laravel 5/6/7/8/9/10/11/12](http://www.laravel.com/) service provider for including the [Captcha for Laravel](https://github.com/mewebstudio/captcha).

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

Preview
-------

[](#preview)

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

- [Captcha for Laravel 5/6/7](#captcha-for-laravel-5-6-7)
    - [Preview](#preview)
    - [Installation](#installation)
    - [Usage](#usage)
    - [Configuration](#configuration)
    - [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 `Masoud5070/captcha` package and setting the `minimum-stability` to `dev` (required for Laravel 5) in your project's `composer.json`.

```
{
    "require": {
        "laravel/framework": "5.0.*",
        "Masoud5070/captcha": "~2.0"
    },
    "minimum-stability": "dev"
}
```

or

Require this package with composer:

```
composer require masoud5070/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 `Masoud5070/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' => [
        // ...
        'Masoud5070\Captcha\CaptchaServiceProvider',
    ]
```

for Laravel 5.1+

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

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

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

for Laravel 5.1+

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

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

[](#configuration)

To use your own settings, publish config.

`$ php artisan vendor:publish`

`config/captcha.php`

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

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;
    });
```

### 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') . ',default'];
    $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/Masoud5070/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 website](http://www.mewebstudio.com)

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance62

Regular maintenance activity

Popularity12

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 56.9% 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

Every ~112 days

Recently: every ~445 days

Total

39

Last Release

234d ago

Major Versions

v1.0.1 → 2.0.02015-04-12

1.0.2 → 2.2.02018-04-25

2.3.0 → 3.0.02019-09-05

PHP version history (5 changes)v1.0.1PHP &gt;=5.3.0

2.0.0PHP &gt;=5.4

3.0.0PHP ^7.2

3.2.5PHP ^7.2|^8.0

3.3.1PHP ^7.2|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/877759d2d33932b98e47f3d76381aacf4feec3856b57ce34b6a3aa15e6530d08?d=identicon)[masoudtajer](/maintainers/masoudtajer)

---

Top Contributors

[![mewebstudio](https://avatars.githubusercontent.com/u/2125733?v=4)](https://github.com/mewebstudio "mewebstudio (123 commits)")[![mauris](https://avatars.githubusercontent.com/u/996939?v=4)](https://github.com/mauris "mauris (33 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)")[![masoudtajer](https://avatars.githubusercontent.com/u/49834756?v=4)](https://github.com/masoudtajer "masoudtajer (5 commits)")[![hutushen222](https://avatars.githubusercontent.com/u/352215?v=4)](https://github.com/hutushen222 "hutushen222 (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)")[![farzinghanbari](https://avatars.githubusercontent.com/u/14145192?v=4)](https://github.com/farzinghanbari "farzinghanbari (2 commits)")[![Assmay](https://avatars.githubusercontent.com/u/18699209?v=4)](https://github.com/Assmay "Assmay (2 commits)")[![jp7anderson](https://avatars.githubusercontent.com/u/9416588?v=4)](https://github.com/jp7anderson "jp7anderson (2 commits)")[![naneri](https://avatars.githubusercontent.com/u/5573469?v=4)](https://github.com/naneri "naneri (1 commits)")[![ocalypto](https://avatars.githubusercontent.com/u/829777?v=4)](https://github.com/ocalypto "ocalypto (1 commits)")[![PouyaPour](https://avatars.githubusercontent.com/u/28677731?v=4)](https://github.com/PouyaPour "PouyaPour (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![smartpixelim](https://avatars.githubusercontent.com/u/6251872?v=4)](https://github.com/smartpixelim "smartpixelim (1 commits)")[![vinodraut](https://avatars.githubusercontent.com/u/12695172?v=4)](https://github.com/vinodraut "vinodraut (1 commits)")[![ycrao](https://avatars.githubusercontent.com/u/3280204?v=4)](https://github.com/ycrao "ycrao (1 commits)")[![eromoe](https://avatars.githubusercontent.com/u/3938751?v=4)](https://github.com/eromoe "eromoe (1 commits)")

---

Tags

captchaLaravel Securitylaravel-captcha

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mews/captcha

Laravel 5/6/7/8/9/10/11/12 Captcha Package

2.6k5.5M84](/packages/mews-captcha)[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)[bonecms/laravel-captcha

Captcha integration for Laravel

76138.4k](/packages/bonecms-laravel-captcha)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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