Download the PHP package jason/captcha without Composer

On this page you can find all versions of the php package jason/captcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package captcha

Captcha for Laravel 11/12/13

PHP Version Latest Version License Downloads Laravel GitHub Stars

一个为 Laravel 11/12/13 深度定制的现代化验证码组件。基于 Intervention Image v3 构建,采用模块化设计,易于扩展和维护。

特性

预览

生成全部 8 种样式预览:

default math number flat mini inverse admin chinese

💡 预览图为随机生成,每次运行 php preview.php 会重新生成不同内容。

安装

通过 Composer 安装:

在 Windows 环境下,确保 php.ini 中启用了 php_gd.dllphp_imagick.dll

配置

发布配置文件:

config/captcha.php 中预置了 8 种验证码样式:defaultmathnumberflatminiinverseadminchinese

每个样式可独立配置以下选项:

选项 类型 默认值 说明
length int 4 验证码字符个数
width int 120 图片宽度(px)
height int 36 图片高度(px)
quality int 90 JPEG 输出质量(0-100)
math bool false 算术模式,生成加减乘算式
expire int 60 有效期(秒)
encrypt bool false 是否加密验证码 key 后传输
sensitive bool false 是否区分大小写
angle int 15 字符最大旋转角度
lines int 3 干扰线数量
lineWidth int 1 干扰线宽度(px)
lineColor string #ff00ff 干扰线颜色(十六进制)
bgImage bool true 是否使用随机背景图片
bgColor string #ffffff 背景颜色(bgImage=false 时生效)
fontColors array 字体颜色列表,每个字符随机选取
contrast int 0 对比度调整(负值降低、正值增加)
sharpen int 0 锐化强度
blur int 0 模糊强度
invert bool false 反转图片颜色
characters array 自定义字符集
marginTop int 自动 文字上边距(px)
textLeftPadding int 4 文字左边距(px)
fontsDirectory string 包内路径 自定义字体目录
bgsDirectory string 包内路径 自定义背景图目录

示例——math 样式(算术验证码):

chinese 样式(中文字符验证码):

使用方法

1. 传统 Session 模式

在视图中显示验证码:

在控制器中进行验证:

2. 无状态 API 模式

获取验证码数据(JSON 响应): GET /captcha/api/default

返回示例:

前端验证时,需将 key 一并传回后端:

辅助函数

架构

采用模块化分层设计,各层职责清晰、易于扩展:

职责
内容生成 CaptchaGenerator — StringGeneratorMathGeneratorChineseGenerator 生成验证码内容(字符串、算术表达式、中文汉字)
图像渲染 ImageCreator 将内容绘制为验证码图片(背景/文字/干扰线/特效)
配置管理 Support/Config 合并全局配置与样式配置
核心编排 Captcha 协调生成与验证流程,支持 Session/API 两种模式
Facade Facades/Captcha 提供简洁的静态访问接口

鸣谢

本项目基于原 mews/captcha 进行现代化重构。

协议

MIT License


All versions of captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-gd Version *
laravel/framework Version ^12.0|^13.0
intervention/image Version ^4.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jason/captcha contains the following files

Loading the files please wait ...