ady/captcha-bundle

User and privacy friendly captcha for your Symfony project

Installs: 2 828

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

v1.0.1 2021-08-07 05:02 UTC

This package is auto-updated.

Last update: 2024-11-07 12:26:13 UTC


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

SupportVersion
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 to false if your form is mapped to an entity
  • required should set to true

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: