PHPackages                             wasksofts/codeigniter-math-captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. wasksofts/codeigniter-math-captcha

ActiveLibrary[Security](/categories/security)

wasksofts/codeigniter-math-captcha
==================================

captcha verification with math quiz

v1.0(6y ago)2643[2 issues](https://github.com/wasksofts/codeigniter-math-captcha/issues)MITPHPPHP ^5.6|^7

Since Jun 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/wasksofts/codeigniter-math-captcha)[ Packagist](https://packagist.org/packages/wasksofts/codeigniter-math-captcha)[ Docs](https://github.com/wasksofts/codeigniter-math-captcha)[ RSS](/packages/wasksofts-codeigniter-math-captcha/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

CodeIgniter-math-captcha
========================

[](#codeigniter-math-captcha)

Math CAPTCHA Library for CodeIgniter, generate random sum of numbers

Install
=======

[](#install)

Install the libray for using by autoload.

```
$ composer require wasksofts/codeigniter-math-captcha
```

usage
=====

[](#usage)

controller
==========

[](#controller)

```
 class Test extends CI_Controller
 {
    public function index()
  {
         $this->load->library('mathcaptcha');
	$this->form_validation->set_rules('captcha', 'captcha', 'trim|xss_clean|required|callback__check_captcha');

	if ($this->form_validation->run()) {
		echo 'success';
	}
	//how to controll whether to use this library or another
	$data['show_captcha']    = TRUE;
	$data['captcha_html']    = $this->mathcaptcha->create_captcha();
	$this->load->view('form_view', $data);
  }

  //this is callback function for validation
   public function _check_captcha($code)
  {
	return $this->mathcaptcha->_check_captcha($code);
  }
    }

```

add this html part to your form
===============================

[](#add-this-html-part-to-your-form)

```
