erfanwmb/captcha
最新稳定版本:v1.2.0
Composer 安装命令:
composer require erfanwmb/captcha
包简介
This package is for captcha
README 文档
README
Installation
Require this package with composer. It is recommended to only require the package for development.
composer require erfanwmb/captcha
You can change SECURITY_CAPTCHA in .env to gd or recaptcha or hcaptcha
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="erfanwmb\captcha\CaptchaServiceProvider"
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
erfanwmb\captcha\CaptchaServiceProvider::class,
If you want to use the facade to log messages, add this to your facades in app.php:
'captcha' => erfanwmb\captcha\CaptchaFacade::class
Usage
-
set your recaptcha(google)
SECURITY_RECAPTCHA_SITE_KEYandSECURITY_RECAPTCHA_SECRET_KEYfor user recaptcha in config.env -
set your hcaptcha
SECURITY_RECAPTCHA_SITE_KEYandSECURITY_RECAPTCHA_SECRET_KEYfor user hcaptcha in config.env -
add flowing code to view to show captcha
@include('captcha.index')
example
@include('captcha.index',['theme_captcha'=>'light','exclusive_captcha'=>'gd'])
you can use exclusive_captcha for customize captcha in views
you can use theme_captcha for customize theme captcha in views
- use this to your request or validation
'g-recaptcha-response'=> [CaptchaFacade::validate($this->exclusive_captcha ?? null)]
warning
you don't need to add required for validation g-recaptcha-response
Update
- for update, you can use following command for just update views
php artisan vendor:publish --provider="erfanwmb\captcha\CaptchaServiceProvider" --tag="view"
-and if you want to update captcha config you can use following command
warning
this command rewrite all captcha config so recaptcha and hcaptcha (site_key & secret_key) delete
php artisan vendor:publish --provider="erfanwmb\captcha\CaptchaServiceProvider" --tag="config"
if you want to disable captcha temporally use following command
SECURITY_CAPTCHA=null
统计信息
- 总下载量: 59
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-23