ady / captcha-bundle
User and privacy friendly captcha for your Symfony project
Requires
- php: >=7.2
- symfony/form: ~4.0|~5.0
- symfony/framework-bundle: ~4.0|~5.0
- symfony/translation: ~4.0|^5.0
- symfony/validator: ~4.0|^5.0
- twig/twig: ^2.10|^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^7.5.15|^8.5|^9.0
- symfony/phpunit-bridge: ^4.0|^5.0
README
CaptchaBundle
[![pipeline status](https://gitlab.com/adynemo/captchabundle/badges/main/pipeline.svg)](https://gitlab.com/adynemo/captchabundle/-/commits/main) [![coverage report](https://gitlab.com/adynemo/captchabundle/badges/main/coverage.svg)](https://gitlab.com/adynemo/captchabundle/-/commits/main)Overview
Make your website more secure and keep the robots away!
This bundle allows you to add a simple and privacy-friendly captcha to your Symfony's forms.
No Google dependency or other third party. This is just a simple challenge, a random question that the user have to answer to validate the form.
Requirements
Support | Version |
---|---|
Symfony | ^4.0 / ^5.0 |
PHP | ^7.2 / ^8.0 |
Installation
composer require ady/captcha-bundle --prefer-dist
Use
Add field
Add a new field to your form with CaptchaType
. Some options are recommended:
mapped
should set tofalse
if your form is mapped to an entityrequired
should set totrue
So, your captcha field looks like:
use Ady\Bundle\CaptchaBundle\Form\CaptchaType;
->add('captcha', CaptchaType::class, [
'mapped' => false,
'required' => true,
])
Available challenges
- Consonant
Question: What is the third consonant of the word BARBITURIQUE?
Answer: B
- Letter
Question: What is the fifth letter of the word ESCARPOLETTE?
Answer: R
- Vowel
Question: What is the first vowel of the word JACTANCE?
Answer: A
Mechanism
The question is design like What is the %index% %letter% of the word %word%?
. The challenge is chosen randomly among available challenges. The chosen challenge defines the %letter%
and set at random the %index%
. Then, the %word%
is also pick off randomly from batch of words (see Dictionary).
New captcha
You can create your own captcha. It should extend AbstractCaptcha and it must implement CaptchaInterface, that's it!
Contributing
You can propose new captcha or any improvement. To do that, thanks to fork this repository and to submit one merge request. Add some unit test is appreciated. Be sure to run composer test
before submitting your code.
Also, if you have any issue, please submit it on: