Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/torralbodavid/simple-recaptcha-v3
π€ This repository contains simple reCAPTCHA v3 integration for your Laravel application.
https://github.com/torralbodavid/simple-recaptcha-v3
captcha hacktoberfest laravel-application laravel-package laravel-rule recaptcha recaptcha-badge recaptcha-v3 recaptcha-v3-laravel recaptcha-verification snippets
Last synced: 3 months ago
JSON representation
π€ This repository contains simple reCAPTCHA v3 integration for your Laravel application.
- Host: GitHub
- URL: https://github.com/torralbodavid/simple-recaptcha-v3
- Owner: torralbodavid
- License: mit
- Created: 2020-05-13T22:39:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-05T11:40:09.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T11:44:36.977Z (3 months ago)
- Topics: captcha, hacktoberfest, laravel-application, laravel-package, laravel-rule, recaptcha, recaptcha-badge, recaptcha-v3, recaptcha-v3-laravel, recaptcha-verification, snippets
- Language: PHP
- Homepage:
- Size: 130 KB
- Stars: 23
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Simple reCAPTCHA v3 integration
[![Latest Version on Packagist](https://img.shields.io/packagist/v/torralbodavid/simple-recaptcha-v3.svg?style=flat-square)](https://packagist.org/packages/torralbodavid/simple-recaptcha-v3)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/torralbodavid/simple-recaptcha-v3/run-tests?label=tests)
[![Quality Score](https://img.shields.io/scrutinizer/g/torralbodavid/simple-recaptcha-v3.svg?style=flat-square)](https://scrutinizer-ci.com/g/torralbodavid/simple-recaptcha-v3)
[![Total Downloads](https://img.shields.io/packagist/dt/torralbodavid/simple-recaptcha-v3.svg?style=flat-square)](https://packagist.org/packages/torralbodavid/simple-recaptcha-v3)This repository contains simple reCAPTCHA v3 integration for your Laravel application.
## Installation
You can install the package via composer:
```bash
composer require torralbodavid/simple-recaptcha-v3
```## Usage
1. Set the following variables in your .env
Override xxxxx with your reCaptcha v3 keys. Get yours [here](https://www.google.com/recaptcha/admin)
```
CAPTCHA_SITE_KEY=xxxxx
CAPTCHA_SECRET_KEY=xxxxx
```Optionally, you can publish the config file of the package. You will be able to customize advanced settings, such as:
* Disabling reCaptcha v3
* Minimum score you should get in order to validate your form
* Hostname validation
* Hide reCaptcha badge
* Prefer navigator language on reCaptcha badge```bash
php artisan vendor:publish --provider="Torralbodavid\SimpleRecaptchaV3\SimpleRecaptchaV3ServiceProvider" --tag=config
```2. To get started, you must include at the very bottom of your head tag from the pages you want to protect with reCaptcha, the `@captcha_init` blade directive. This will start loading Google reCAPTCHA API.
```html
...
@captcha_init
```3. Include below your form initialization tag, the `@captcha('xxxx')` blade directive. Replace xxxx with your desired [action](https://developers.google.com/recaptcha/docs/v3#actions).
```html
@captcha('login')
...
```4. To sum up, add the following rule on your form validation:
```php
'recaptcha_response' => new Captcha
``````php
use Torralbodavid\SimpleRecaptchaV3\Rules\Captcha;
...
$request->validate([
...
'recaptcha_response' => new Captcha,
]);
```### Customize error messages
You can customize reCaptcha v3 error messages by publishing the translations on your project.
```bash
php artisan vendor:publish --provider="Torralbodavid\SimpleRecaptchaV3\SimpleRecaptchaV3ServiceProvider" --tag=lang
```### Customize snippets
You can customize @captcha and @captcha_init snippets by publishing the views on your project
```bash
php artisan vendor:publish --provider="Torralbodavid\SimpleRecaptchaV3\SimpleRecaptchaV3ServiceProvider" --tag=views
```### Disable reCaptcha v3 integration in tests
You can easily disable reCaptcha v3 integration in your tests by adding the following configuration on them
```php
config()->set('simple-recaptcha-v3.active', false);
```### Testing
``` bash
composer test
```### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [David Torralbo PΓ©rez](https://github.com/torralbodavid)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Have fun!