cripcha / cripcha-bundle
Symfony bundle of Cripcha: form type, validation constraint and Twig helper for the privacy-first, cookie-free captcha
Package info
github.com/cripcha/cripcha-bundle
Type:symfony-bundle
pkg:composer/cripcha/cripcha-bundle
Requires
- php: >=8.2
- cripcha/cripcha-php: ^1.0
- symfony/config: ^6.4 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/http-foundation: ^6.4 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.0 || ^8.0
- symfony/validator: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpunit/phpunit: ^11.0
- symfony/form: ^6.4 || ^7.0 || ^8.0
- symfony/framework-bundle: ^6.4 || ^7.0 || ^8.0
- symfony/translation: ^8.1
- symfony/twig-bundle: ^6.4 || ^7.0 || ^8.0
Suggests
- symfony/form: For the CripchaType form type
- symfony/twig-bundle: For the cripcha_widget() Twig function and the form theme
Provides
None
Conflicts
None
Replaces
None
README
Cripcha for Symfony 6.4, 7 and 8: a form type, a validation constraint and a Twig function.
composer require cripcha/cripcha-bundle
(Or offline: download cripcha-php.zip and cripcha-bundle.zip from cripcha.crispy-medias.fr into artifacts/, then
composer config repositories.cripcha artifact ./artifacts before the require.)
Then register the bundle in config/bundles.php if Flex did not: Cripcha\Bundle\CripchaBundle::class => ['all' => true].
The keys come from the environment, no configuration file needed:
# .env.local CRIPCHA_SITE_KEY=ck_… CRIPCHA_SECRET=cs_…
Optional config/packages/cripcha.yaml (other keys, api_url, widget_url, timeout):
when@test: cripcha: enabled: false # every token accepted in the tests of the application
Form component:
$builder->add('cripcha', CripchaType::class); // shows the widget, checks the token
Without the Form component (a DTO bound with #[MapRequestPayload], a hand-written form):
#[Cripcha] // reads the field cripcha-response of the request public string $email;
<form method="post">… {{ cripcha_widget() }} <button>Send</button></form> {{ cripcha_widget({form: '#login'}) }} {# outside of the form #}
The error message is translated (fr, en, es, de, nl, it, pt, uk, ro, ru; domain validators; in English without the Translation component).