Download the PHP package larva/laravel-captcha without Composer

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

laravel-captcha

适用于 Laravel 的验证码服务,支持 GD 和 ImageMagick 两种图像库。

Latest Stable Version Latest Unstable Version License

环境需求

如果希望使用 ImageMagick 代替 GD,需安装 PHP Imagick 扩展(支持 PNG 格式)。

安装

发布配置和字体文件

安装后,建议发布配置文件和字体文件到项目目录,以便自定义:

配置

发布配置文件后,可在 config/captcha.php 中调整以下参数:

参数 类型 默认值 说明
testLimit int 3 同一验证码最多可验证次数,超过后自动刷新。设为 0 表示不限制
width int 120 验证码图片宽度(像素)
height int 50 验证码图片高度(像素)
padding int 2 文字与图片边缘的内边距(像素)
backColor int 0xFFFFFF 背景颜色(十六进制),默认白色
foreColor int 0x2040A0 字体颜色(十六进制),默认蓝色
transparent bool false 是否使用透明背景
minLength int 6 验证码最小长度
maxLength int 7 验证码最大长度
offset int -2 字符间距,增大可提高可读性
fontFile string resource_path('fonts/SpicyRice.ttf') TrueType 字体文件路径
imageLibrary string 'gd' 图像渲染库,可选 'gd' 或 'imagick',留空则自动检测

使用

1. 显示验证码

安装后自动注册路由,直接访问即可输出验证码图片:

在表单中引用:

点击图片即可刷新验证码。

2. AJAX 刷新验证码

通过添加 refresh 参数可以获取新的验证码信息(JSON 格式):

返回内容:

使用返回的 url 更新图片 src 属性即可刷新验证码。

3. 表单验证

方式一:使用自定义验证规则(推荐)

包中注册了 captcha 验证规则,可直接在验证规则中使用:

方式二:手动验证

通过 Captcha Facade 手动验证用户输入:

4. 在测试环境固定验证码

在 phpunit 等测试环境中,验证器会自动将验证码固定为 1234,方便编写自动化测试。

也可以手动设置固定验证码:

License

MIT License


All versions of laravel-captcha with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-gd Version *
illuminate/support Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
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 larva/laravel-captcha contains the following files

Loading the files please wait ...