This bundle provides an easy way to integrate CAPTCHA validation into Symfony forms using the AgilelabFrCaptchaType
form field. It enhances security by preventing automated submissions while ensuring a seamless user experience.
composer require agilelab-fr/captcha-bundle
After installation, you need to uncomment the following line in config/packages/agilelab_fr_captcha.yaml
twig:
form_themes:
- '@AgilelabFrCaptcha/form/agilelab_fr_captcha.html.twig'
- Install via Composer:
composer require agilelab-fr/captcha-bundle
- Manually enable the bundle in
config/bundles.php
:return [ AgilelabFr\CaptchaBundle\AgilelabFrCaptchaBundle::class => ['all' => true], ];
- Add the configuration manually (see below).
To add a CAPTCHA field to your form:
use AgilelabFr\CaptchaBundle\Form\AgilelabFrCaptchaType;
$builder->add('captcha', AgilelabFrCaptchaType::class);
If you are not using Symfony Flex, manually add these configurations:
captcha_bundle:
width: 120
height: 40
length: 6
lines: 8
characters: 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'
case_sensitive: true
# Uncomment to render the twig block for captcha
twig:
form_themes:
- '@AgilelabFrCaptcha/form/agilelab_fr_captcha.html.twig'
agilelab_fr_captcha_bundle.routes:
resource: '@AgilelabFrCaptchaBundle/config/routes.yaml'
This bundle is licensed under the MIT License.