tejas / tejascaptcha
适用于 Laravel 框架的 Tejas Captcha
Requires
- php: >=7.0
- ext-gd: *
- intervention/image: >=2.2
- laravel/framework: >=7.9
Requires (Dev)
- mockery/mockery: >=0.9
- phpunit/phpunit: >=4.1
- dev-master
- 1.0.12.55
- 1.0.12.54
- 1.0.12.53
- 1.0.12.52
- 1.0.12.51
- 1.0.12.50
- 1.0.12.49
- 1.0.12.48
- 1.0.12.47
- 1.0.12.46
- 1.0.12.45
- 1.0.12.44
- 1.0.12.43
- 1.0.12.42
- 1.0.12.41
- 1.0.12.40
- 1.0.12.39
- 1.0.12.38
- 1.0.12.37
- 1.0.12.36
- 1.0.12.35
- 1.0.12.34
- 1.0.12.33
- 1.0.12.32
- 1.0.12.31
- 1.0.12.30
- 1.0.12.29
- 1.0.12.28
- 1.0.12.27
- 1.0.12.26
- 1.0.12.25
- 1.0.12.24
- 1.0.12.23
- 1.0.12.22
- 1.0.12.21
- 1.0.12.20
- 1.0.12.19
- 1.0.12.18
- 1.0.12.17
- 1.0.12.16
- 1.0.12.15
- 1.0.12.14
- 1.0.12.13
- 1.0.12.12
- 1.0.12.11
- 1.0.12.10
- 1.0.12.9
- 1.0.12.8
- 1.0.12.7
- 1.0.12.6
- 1.0.12.5
- 1.0.12.4
- 1.0.12.3
- 1.0.12.2
- 1.0.12.1
- 1.0.12.0
- 1.0.11.0
- 1.0.10.0
- 1.0.9.0
- 1.0.8.0
- 1.0.7.0
- 1.0.6.0
- 1.0.5.0
- 1.0.4.0
- 1.0.3.0
- 1.0.2.0
- 1.0.1.0
- 1.0.0.0
- 0.3.2.1
- 0.3.1.1
- 0.3.0.1
- 0.2.9.1
- 0.2.8.1
- 0.2.7.1
- 0.2.6.1
- 0.2.5.1
- 0.2.4.1
- 0.2.3.1
- 0.2.2.1
- 0.2.1.1
This package is auto-updated.
Last update: 2024-09-21 10:58:14 UTC
README
tejas/tejascaptcha 是 Laravel 的服务提供者。该包随机生成字母数字验证码或数学验证码,并提供刷新和音频功能。
章节链接
预览
兼容性
tejas/tejascaptcha 服务提供者已在 Laravel 版本 5、6 和 7 上进行了测试。测试是在 Linux / Debian / Apache2 网络服务器上进行的。
安装
Tejas Captcha
TejasCaptcha 服务提供者通过 Composer 安装。
从您项目根目录,打开终端并运行以下命令
composer require tejas/tejascaptcha
npm install bootstrap
npm install @fortawesome/fontawesome-free
Tejas Captcha 中间件 - 验证码验证
app/Http/Middleware/VerifyTejasCaptcha.php
中间件用于验证验证码是否正确输入。
从您项目根目录,打开终端并运行以下命令
cp vendor/tejas/tejascaptcha/src/app/Http/Middleware/VerifyTejasCaptcha.php app/Http/Middleware/
.
此命令将 VerifyTejasCaptcha.php
中间件占位符文件复制到您的项目 app/Http/Middleware
文件夹。
namespace App\Http\Middleware;
use Tejas\TejasCaptcha\Http\Middleware\VerifyTejasCaptcha as Middleware;
class VerifyTejasCaptcha extends Middleware
{
/*
Uses the tejas/tejascaptcha service providers middleware
*/
}
app/Http/Kernel.php
在 app/Http/Kernel.php
文件的 routeMiddleware
部分的底部插入以下行
'tejascaptcha_verify_captcha' => \App\Http\Middleware\VerifyTejasCaptcha::class,
在需要包含 tejas/tejascaptcha 的 Post 提交的地方使用此中间件声明。
example/routes/web.php
使用 tejascaptcha 中间件示例表单提交路由
此路由声明在 example/routes/web.php
文件中。它是 Tejas Captcha 包附带的工作示例文件的一部分。有关实现细节,请参阅 example/README.md。
Route::post('tejascaptcha_verify_form','TejasCaptcha_Controller@tejasCaptcha')->middleware('tejascaptcha_verify_captcha');
Bootstrap - Laravel 安装
打开终端,导航到您的项目根目录并运行
composer require laravel/ui
php artisan ui bootstrap
- 如果您还想要认证架构:
php artisan ui bootstrap --auth
- 如果您还想要认证架构:
npm install && npm run dev
Tejas Captcha Makefile - 安装后
此步骤是可选的。
要安装包含的 Makefile,请从您的项目根目录运行以下命令。
- cd vendor/tejas/tejascaptcha/scripts && bash postinstall.sh && cd ../../../../
Makefile 已安装到您项目根目录中的 tejascaptcha 目录中。
安装后运行 tejascaptcha/Makefile;从您的项目根目录运行以下命令,并使用指定的 make 操作之一
- make -C tejascaptcha [ install update test remove show_version ]
注册 Tejas Captcha 服务提供者
此步骤是可选的 - tejas/tejascaptcha 通过 Composer 包发现自动注册。
config/app.php
在 config/app.php
文件的 providers
键下注册 tejas/tejascaptcha
服务提供者。
'providers' => [ Tejas\TejasCaptcha\TejasCaptchaServiceProvider::class, ]
在 config/app.php
文件的 aliases
键下注册 tejas/tejascaptcha
服务提供者的别名。
'aliases' => [ 'TejasCaptcha' => Tejas\TejasCaptcha\Facades\TejasCaptcha::class, ]
配置
发布配置文件
config/tejascaptcha.php
要自定义 tejas/tejascaptcha 的设置,请从您的项目根目录运行 Laravel 的 vendor:publish
artisan 命令。
$ php artisan vendor:publish
示例输出
输入 tejascaptcha 服务提供者对应的数字并按回车。tejas/tejascaptcha 的配置文件 tejascaptcha.php
的可编辑副本应已复制到您的项目 config
目录。
简化的默认配置文件
<?php
return [
'config_section_key' => 'standard',
'standard' => [
'length' => 5,
'width' => 230,
'height' => 50,
'quality' => 90,
'sensitive' => false,
],
'flat' => [], 'mini' => [], 'inverse' => [],
'audio' => [
'audioFilePrefix' => 'final'
]
];
配置文件中有7个键。`config_section_key
`可能指向四个预构建的图像表示部分之一,`standard
`是默认的`config_section_key
`值。您可以通过将其设置为`'flat', 'mini'或'inverse'`来覆盖此值。🔺您还可以通过将`'flat', 'mini'或'inverse'`指定为`tejascaptchaImageType
`的后置值来覆盖图像选择。
🔺请参考在`$('#tejas_captcha_refresh_icon')
`点击函数中的`tejas/tejascaptcha/example/js/tejascaptcha.js
`文件。
`audio
`键指定音频文件名称的前缀。