PHPackages                             stefan-z/laravel-sanctum-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. stefan-z/laravel-sanctum-captcha

ActiveLibrary

stefan-z/laravel-sanctum-captcha
================================

Create a captcha image for stateless laravel sanctim api's

0.0.6(2y ago)029↓100%MITPHPPHP ^8.2

Since Oct 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/StefanZimmermann98/laravel-sanctum-captcha)[ Packagist](https://packagist.org/packages/stefan-z/laravel-sanctum-captcha)[ RSS](/packages/stefan-z-laravel-sanctum-captcha/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (0)

PHP SecureImage-Captcha for Laravel Sanctum
===========================================

[](#php-secureimage-captcha-for-laravel-sanctum)

This project is for those who have a Laravel-Sanctum-based API in place without the possibility of using a stateful-session-based temporary storage, who want to simply create captcha images e.g. for their login process.

The base idea is the serve the user with an image and a encrypted text. Once displaying the image on your site, the user has to submit an input and provide you with the cipher-text. Your server-side implementation can then receive both those inputs and validate the captcha-input using the same class and secret-key (which was used while creating the captcha) to validate if the user input is indead the displayed captcha.

The following attributes can be set via a simple Builder-Interface:

- secret
- cipher (default is aes-128-cbc)
- captcha length
- background color
- TTF-Font
- Number of Lines
- Number of Dots

Example
=======

[](#example)

```
$captcha = (new SecureImage(env('CAPTCHA_SECRET')))
            ->setFont(__DIR__
            . DIRECTORY_SEPARATOR . '..'
            . DIRECTORY_SEPARATOR . '..'
            . DIRECTORY_SEPARATOR . '..'
            . DIRECTORY_SEPARATOR . 'resources'
            . DIRECTORY_SEPARATOR . 'fonts'
            . DIRECTORY_SEPARATOR . 'arial.ttf')
        ->setNumberOfLines(20) // Random Lines for obfuscation
        ->setNumberOfDots(800) // Random Dots for obfuscation
        ->setBackground(150, 150, 150, 0.4) // RGBA
        ->setLength(7) // Captcha-Length
        ->setWidth(200) // Image Width
        ->setHeight(100); // Image Height

        return $captcha->generateCaptcha();

```

[![Example](./example.jpeg)](./example.jpeg)

```
$captcha = new SecureImage(env('CAPTCHA_SECRET'));
return $captcha->is_valid($user_input, $cipher_text_generated_with_captcha);

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

6

Last Release

927d ago

### Community

Maintainers

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

---

Top Contributors

[![StefanZimmermann98](https://avatars.githubusercontent.com/u/47888671?v=4)](https://github.com/StefanZimmermann98 "StefanZimmermann98 (7 commits)")

### Embed Badge

![Health badge](/badges/stefan-z-laravel-sanctum-captcha/health.svg)

```
[![Health](https://phpackages.com/badges/stefan-z-laravel-sanctum-captcha/health.svg)](https://phpackages.com/packages/stefan-z-laravel-sanctum-captcha)
```

PHPackages © 2026

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