Download the PHP package wpjscc/captcha without Composer

On this page you can find all versions of the php package wpjscc/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

与框架无关的 PHP 验证码库,API 设计参考 mewebstudio/captcha。

支持可插拔的文件驱动,默认提供本地文件驱动;同时支持会话模式与无状态 API 模式。

要求

安装

快速开始

使用方式

注入文件驱动

实例化时传入 FileDriverInterface,第三方可自行实现(如 OSS、S3 等):

也可使用快捷方法,内置 LocalFileDriver:

会话模式

适用于传统 Web 表单,验证码状态保存在 Storage 中:

多 Session 支持(常驻进程)

LocalStorage 可按 sessionId 隔离多个会话,适合 Swoole / Workerman 等只实例化一次的场景:

不传 sessionId 时默认使用 'default'。同一 sessionId 下仍只保留最新一张验证码(刷新会覆盖旧的)。

API 模式(无状态)

适用于前后端分离场景,生成时返回 key 和 base64 图片,校验时携带 key:

预设配置

内置多种配置方案,通过第一个参数切换:

配置

构造函数第二个参数可覆盖默认配置,完整默认值见 config/captcha.php:

配置项 说明
length 验证码字符长度
width / height 图片尺寸
math 启用算术验证码(如 12 + 3 =)
sensitive 区分大小写
expire 过期时间(秒)
encrypt 是否加密存储 key
bgImage 是否使用背景图
bgColor 背景颜色(bgImage=false 时生效)
fontColors 字体颜色列表

自定义文件驱动

实现 Captcha\Contracts\FileDriverInterface 接口:

自定义存储驱动

实现 Captcha\Contracts\StorageInterface 接口,可对接 Redis、Memcached 等:

项目结构

测试

License

MIT


All versions of captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-gd Version *
ext-json Version *
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 wpjscc/captcha contains the following files

Loading the files please wait ...