cripcha / cripcha-php
Server side check of Cripcha tokens: the privacy-first, cookie-free captcha hosted in the EU
v1.0.3
2026-11-27 21:35 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Suggests
- ext-curl: Used to call the API when available (otherwise PHP streams)
- psr/http-client: To use the PSR-18 HTTP client of your project (Psr18Transport)
Provides
None
Conflicts
None
Replaces
None
README
Server side check of Cripcha tokens. No dependency (curl, or PHP streams).
composer require cripcha/cripcha-php
(Or offline: download cripcha-php.zip from cripcha.crispy-medias.fr into artifacts/, then
composer config repositories.cripcha artifact ./artifacts before the require.)
use Cripcha\Client; $client = new Client($_ENV['CRIPCHA_SECRET']); // cs_…, never in a template $result = $client->verify($_POST[Client::TOKEN_FIELD] ?? ''); if (!$result->success) { // refuse the form; $result->errorCodes tells why }
In the form: <div class="cripcha" data-sitekey="ck_…"></div> and the script of the widget.
- Fails closed: an unreachable API or an unexpected answer refuses the form, without exception.
- A token works once: verify it once per submission.
- Your PSR-18 client:
new Client($secret, transport: new Psr18Transport($client, $requestFactory, $streamFactory)). - Self-hosted or tests:
new Client($secret, 'https://cripcha.example.internal/api/v1'), test secretscs_test_always_pass/cs_test_always_fail.