Download the PHP package mortezaashrafi/filament-shield-captcha without Composer
On this page you can find all versions of the php package mortezaashrafi/filament-shield-captcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mortezaashrafi/filament-shield-captcha
More information about mortezaashrafi/filament-shield-captcha
Files in mortezaashrafi/filament-shield-captcha
Package filament-shield-captcha
Short Description Production-grade inline image CAPTCHA field for Filament forms (PHP GD, zero image persistence).
License MIT
Informations about the package filament-shield-captcha
mortezaashrafi/filament-shield-captcha
A production-grade inline Image CAPTCHA field for Filament forms.
- Native PHP GD only (no Intervention Image)
- Zero image file persistence (no temporary files, nothing written to disk)
- Base64 data URI output rendered inline inside Filament forms
- Deterministic noise per challenge (stable across Livewire re-renders)
- Session/cache-based server-side verification with TTL, max attempts, replay protection
- Bundled fonts (OFL): Vazirmatn + Noto Sans, with custom font path support
- Auto RTL support: Automatically switches fonts based on locale direction.
Screenshots
Panel (Light / Dark):
![]() |
![]() |
Login page (Light / Dark):
![]() |
![]() |
Compatibility
| Package | Versions |
|---|---|
| PHP | 8.2, 8.3, 8.4, 8.5 |
| Laravel | 11, 12, 13 |
| Filament | 3, 4, 5 |
Installation
GD requirement
This package requires PHP GD with FreeType support (for imagettftext()).
Common installs:
- Debian/Ubuntu:
sudo apt-get install php-gd - Alpine:
apk add php82-gd(match your PHP version)
Configuration
Publish the config file:
Config file: config/filament-shield-captcha.php
Usage in Forms
Customization (Fluent API)
| Method | Description | Range / Limits |
|---|---|---|
->length(int) |
Number of characters in CAPTCHA | 1 to 12 (recommended 4-6) |
->width(int) |
Image width in pixels | min 100 (recommended 220) |
->height(int) |
Image height in pixels | min 30 (recommended 60) |
->fontSize(int) |
Font size in pixels | 12 to 40 (recommended 26) |
->font(string) |
Use bundled font key (vazirmatn, noto_sans) |
- |
->rtl() |
Force RTL mode (uses rtl font from config) |
- |
->ltr() |
Force LTR mode (uses ltr font from config) |
- |
->numeric() |
Numbers only (0-9) | - |
->alphabetic() |
Letters only (A-Z) | - |
->alphanumeric() |
Letters and numbers (Default) | - |
->symbols(string) |
Alphanumeric + custom symbols | default symbols: !@#$%^&*+-= |
->charset(string) |
Completely custom character set | - |
->caseSensitive(bool) |
Require exact case matching | default: false |
->noise(level, lines, dots) |
Adjust image noise complexity | level 0-5 (default 2) |
->ttl(int) |
Challenge expiry in seconds | default 300 |
->maxAttempts(int) |
Max wrong attempts before lock | default 5 |
Example with full options:
Integration with Filament Auth Pages
To add CAPTCHA to Filament's built-in Login, Register, or Reset Password pages (v5), follow these steps:
1. Create Custom Auth Components
Extend the original Filament Auth pages and use the InteractsWithCaptcha trait.
Login Page: app/Filament/Pages/Auth/Login.php
Register Page: app/Filament/Pages/Auth/Register.php
Password Reset Page: app/Filament/Pages/Auth/RequestPasswordReset.php
2. Register Custom Pages in Panel Provider
Update your AdminPanelProvider.php (or other panel provider) to use your custom Auth pages:
RTL / LTR Support
The package automatically detects the current locale direction. You can configure default fonts for each direction in the config file:
Security & Architecture
- In-Memory Generation: Images are created via GD and encoded to base64 data URIs. No files are ever written to the disk.
- Server-Side Verification: The expected answer is never exposed to the client.
- Replay Protection: Successful verification invalidates the challenge immediately.
- Rate Limiting: Wrong attempts increment a counter; once
maxAttemptsis reached, the challenge is locked and must be refreshed.
Fonts
Bundled (OFL):
- Vazirmatn: Excellent for Persian/Arabic-friendly UI.
- Noto Sans: Reliable Latin-friendly default.
To use your own font:
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-shield-captcha with dependencies
ext-gd Version *
filament/filament Version ^3.0 || ^4.0 || ^5.0
illuminate/cache Version ^11.0 || ^12.0 || ^13.0
illuminate/contracts Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0



