BotDetect CodeIgniter 3 CAPTCHA Integration Quickstart

Unlike Recaptcha the Stalker -- BotDetect CAPTCHA works in China! Licensable source-code; self-hosted -- doesn't stalk -- nor does it slurp your form-data! Think: GDPR & LGPD!

1. Copy CodeIgniter Captcha Library Files

Path Aliases Used Throughout This Guide

  • Download the BotDetect Captcha CodeIgniter integration package and copy <BDCIPACK>/plugin/codeigniter-3/

  • Copy:

  • Copy BotDetect PHP Captcha library from:

2. Show a Captcha Challenge on the Form

a) If CodeIgniter is a backend for your js-based frontend, perhaps you should start with a guide that describes integration from js-framework point of view: jQuery, Angular, AngularJS, or React.

b) If you are using CodeIgniter forms, here is how to configure Captcha options, and display Captcha in your CodeIgniter form:

Register default route of the Captcha library:
$route['botdetect/captcha-handler'] = 'botdetect/captcha_handler/index';
Captcha configuration options (application/config/captcha.php):
// BotDetect PHP Captcha configuration options

$config = array(
  // Captcha configuration for example page
  'ExampleCaptcha' => array(
    'UserInputID' => 'CaptchaCode',
    'ImageWidth' => 250,
    'ImageHeight' => 50,

Load the BotDetect CodeIgniter library and generate the Captcha markup in your Controller:
public function index() // Your controller
  // load the BotDetect Captcha library and set its parameter
  $this->load->library('botdetect/BotDetectCaptcha', array(
    'captchaConfig' => 'ExampleCaptcha'

  // make Captcha Html accessible to View code
  $data['captchaHtml'] = $this->botdetectcaptcha->Html();
Show the Captcha challenge in the View:
  <link type="text/css" rel="Stylesheet" 
    href="<?php echo CaptchaUrls::LayoutStylesheetUrl() ?>" />
  <?php echo $captchaHtml; ?>
  <input type="text" name="CaptchaCode" id="CaptchaCode" value="" />

3. Check User Input During Form Submission

When the form is submitted, the Captcha validation result must be checked in Controller code:
if ($_POST) {
  // validate the user-entered Captcha code when the form is submitted
  $code = $this->input->post('CaptchaCode');
  $isHuman = $this->botdetectcaptcha->Validate($code);

  if (!$isHuman) {
    // TODO: Captcha validation failed, show error message
  } else {
    // TODO: Captcha validation passed, perform protected action

In-Depth CodeIgniter CAPTCHA Instructions and Explanations

Detailed CodeIgniter Captcha instructions and explanations can be found in the CodeIgniter 3.0 Captcha integration how to guide.

Other BotDetect PHP CAPTCHA Quickstarts


BotDetect CodeIgniter CAPTCHA System Requirements


Supported CodeIgniter Versions:

  • CodeIgniter 3.x