Skip to content

Erfanwmb47/captcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Captcha for Laravel

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Captcha 1.0 Screenshot

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_KEY and SECURITY_RECAPTCHA_SECRET_KEY for user recaptcha in config.env

  • set your hcaptcha SECURITY_RECAPTCHA_SITE_KEY and SECURITY_RECAPTCHA_SECRET_KEY for 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published