yassinedoghri / codeigniter-altcha
A CodeIgniter4 library for ALTCHA, a GDPR, WCAG 2.2 AA, and EAA compliant, self-hosted CAPTCHA alternative with PoW mechanism.
Requires
- php: >=8.2
- altcha-org/altcha: ^1.1
Requires (Dev)
- codeigniter/phpstan-codeigniter: ^1.5.4
- codeigniter4/framework: ^v4.6.0
- pestphp/pest: ^3.8.4
- pestphp/pest-plugin-type-coverage: ^3.6.1
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.1.22
- rector/rector: ^2.1.4
- symplify/coding-standard: ^12.4.3
- symplify/easy-coding-standard: ^12.5.24
README
CodeIgniter ALTCHA 🔥🔄🔒
A CodeIgniter4 library for altcha, a GDPR, WCAG 2.2 AA, and EAA compliant, self-hosted CAPTCHA alternative with PoW mechanism.
🚀 Getting started
0. Prerequisites
Download or install the ALTCHA widget script and include it on the pages where you want to display the CAPTCHA.
Note
Installing via a package manager?
Check out CodeIgniter Vite 🔥⚡ for a fast and simple way to manage JavaScript and TypeScript packages in your CodeIgniter 4 projects.
1. Installation
-
Install
codeigniter-altcha
using composer:composer require yassinedoghri/codeigniter-altcha
-
Add altcha helper to your Autoload.php file:
public $helpers = [/*...other helpers...*/, 'altcha'];
-
Render the ALTCHA widget inside your forms using the
altcha_widget()
helper:<form method="POST" action="/your-endpoint"> <!-- Your form fields go here --> <?= altcha_widget() ?> <button type="submit">Submit</button> </form>
2. Configure
Copy the Altcha.php
config file from
vendor/yassinedoghri/codeigniter-altcha/src/Config/
into your project's config
folder and update the namespace to Config. You will also need to have these
classes extend the original classes.
// new file - app/Config/Altcha.php <?php declare(strict_types=1); namespace Config; // ... use CodeIgniterAltcha\Config\Altcha as CodeIgniterAltcha; class Altcha extends CodeIgniterAltcha { // ... }
⚙️ Config reference
// TODO
❤️ Acknowledgments
This wouldn't have been possible without the amazing work of the
CodeIgniter & altcha-org
teams.
Thank you 🙏
📜 License
Code released under the MIT License.
Copyright (c) 2025-present, Yassine Doghri (@yassinedoghri).