Package Data | |
---|---|
Maintainer Username: | jormin |
Maintainer Contact: | jorminxee@gmail.com (Jormin) |
Package Create Date: | 2017-04-25 |
Package Last Update: | 2019-07-06 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:24:06 |
Package Statistics | |
---|---|
Total Downloads: | 7,506 |
Monthly Downloads: | 79 |
Daily Downloads: | 1 |
Total Stars: | 21 |
Total Watchers: | 2 |
Total Forks: | 6 |
Total Open Issues: | 2 |
极验验证码 v3.0 Laravel 扩展包
安装包文件
$ composer require jormin/laravel-geetest
Laravel
版本大于等于 5.5
, 可以直接跳过前两步,Laravel
会自动发现扩展包注册 ServiceProvider:
Jormin\Geetest\GeetestServiceProvider::class,
添加 Alias
'Geetest' => Jormin\Geetest\Facades\Geetest::class,
创建配置文件、视图级资源文件:
php artisan vendor:publish --provider='Jormin\Geetest\GeetestServiceProvider'
.env
文件增加配置项 GEETEST_ID
和 GEETEST_KEY
| 配置项 | 说明 | 选项 | 默认值 | | ------------ | ------------ | ------------ | ------------ | | width | 按钮宽度 | 单位可以是 px, %, em, rem, pt | 300px| | lang | 语言,极验验证码免费版不支持多国语言 | zh-cn, en, zh-tw, ja, ko, th | zh-cn | | product | 验证码展示方式 | popup, float | popup | | geetest_id | 极验验证码ID | | | | geetest_key | 极验验证码KEY | | | | client_fail_alert | 客户端失败提示语 | | 请完成验证码 | | server_fail_alert | 服务端失败提示语 | | 验证码校验失败 |
安装扩展后,在页面需要使用极验验证码的地方增加如下代码
{!! Geetest::render() !!}
在服务端使用 geetest
验证规则进行二次验证,示例代码:
$this->validate($request, [
'geetest_challenge' => 'required|geetest',
'geetest_validate' => 'required|geetest',
'geetest_seccode' => 'required|geetest',
], [
'geetest' => config('laravel-geetest.server_fail_alert')
]);
The MIT License (MIT). Please see License File for more information.