wiejakp / captcha
Captcha library for PHP applications.
Package info
pkg:composer/wiejakp/captcha
v2.0.0
2026-07-30 16:59 UTC
Requires
- php: ^8.1
- ext-intl: *
- symfony/http-foundation: ^6.4
- symfony/security-core: ^6.4
Requires (Dev)
- phpunit/phpunit: ^10.5
Suggests
- ext-pcov: Provides code coverage for PHPUnit 10 when Xdebug is unavailable.
This package is auto-updated.
Last update: 2026-07-30 17:01:31 UTC
README
Captcha library for PHP applications.
Requirements
- PHP
^8.1 - PHP Intl extension
- Symfony HttpFoundation
^6.4 - Symfony Security Core
^6.4
PCOV or Xdebug is required only when generating code coverage.
Installation
composer require wiejakp/captcha:^2.0
Usage
use wiejakp\captcha\CaptchaService; $captcha = new CaptchaService(); $challenge = $captcha->createPositiveCaptchaChallenge(); echo $challenge->getChallenge(); if ($challenge->isEqual($submittedAnswer)) { // The answer is valid. }
Challenges are stored in the configured Symfony session by default. Pass false to a creation
method when the generated challenge should not be stored.
Tests
Run the suite under PHP 8.1:
composer test
With PCOV enabled, generate coverage using:
composer test:coverage