Download the PHP package wackowiki/freecap without Composer
On this page you can find all versions of the php package wackowiki/freecap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package freecap
freeCap
A modern, object-oriented CAPTCHA library for PHP 8.2+, originally created by Howard Yeend and maintained by the WackoWiki Team. freeCap uses GD to generate highly obfuscated, OCR-resistant CAPTCHA images.
This version has been completely refactored to support Composer, PSR-4 autoloading, custom session adapters, and strict standards. It retains all of the original's educational inline comments and OCR circumvention logic.
Features
- OCR Circumvention: Implements character morphing (sine wave deviations), random fonts, background noise (grid, squiggles, morphed blocks), and blurring.
- Brute Force Protection: Locks out users after a configurable number of refresh attempts.
- Dictionary & Random Words: Supports pulling words from a dictionary file or generating pseudo-random consonant-vowel strings.
- Multiple Formats: Supports outputting
avif,gif,jpg,png, andwebpimages. - Session Adapter API: Decouples session handling from the core logic, making it easy to integrate with any framework (
$_SESSION, custom session objects, PSR-16 caches, etc.). - Graceful Fallbacks: If custom GD fonts or dictionary files are missing, it safely falls back to built-in fonts and random word generation.
Requirements
- PHP >= 8.2
- GD Extension
Installation
Install via Composer:
Directory Structure
Ensure your .ht_freecap_* assets (fonts, dictionaries, background images) are placed in a resources/ directory at the root of your project or package.
Basic Usage
1. Rendering the CAPTCHA Image
In your routing or controller logic, initialize the adapter and call render(). This outputs the image directly to the browser with the correct Content-Type headers.
2. Displaying in HTML
3. Validating User Input
In your form processing logic, verify the submitted word against the session hash. Make sure to set the freecap_shown flag when the form page loads so the validator knows a CAPTCHA was issued.
Configuration Options
You can override default behaviors by passing an array to the FreeCap constructor.
Custom Session Adapters
If you are not using native PHP sessions, you can create your own adapter by implementing the FreeCap\AdapterInterface.
Testing
The package includes PHPUnit 11 tests. To run the test suite:
Credits
- Howard Yeend (solidred.co.uk) - Original author of freeCap v1.4.1
- WackoWiki Team - Modernization, OOP refactor, and maintenance (2008 - 2025)
License
This project is licensed under the GNU General Public License v2.0 or later. See the LICENSE file for more details.
All versions of freecap with dependencies
ext-gd Version *