Notice (8): compact(): Undefined variable: etagMatches [CORE/src/Http/Response.php, line 2051]
Notice (8): compact() [<a href=''>function.compact</a>]: Undefined variable: timeMatches [CORE/src/Http/Response.php, line 2051]
Warning (512): Unable to emit headers. Headers sent in file=/home/inimist/public_html/vendor/cakephp/cakephp/src/Error/Debugger.php line=853 [CORE/src/Http/ResponseEmitter.php, line 48]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/inimist/public_html/vendor/cakephp/cakephp/src/Error/Debugger.php:853) [CORE/src/Http/ResponseEmitter.php, line 148]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/inimist/public_html/vendor/cakephp/cakephp/src/Error/Debugger.php:853) [CORE/src/Http/ResponseEmitter.php, line 177]
Image Captcha demo for Cakephp 3

CakePHP Captcha Plugin


CakePHP 3
CakePHP 1&2


CakePHP 3
CakePHP 1&2


Arvind Kumar
@Inimist Technologies

Need Help?

Get in touch
Call +919876831310

Demo: Image Captcha for Cakephp 3

CakePHP Captcha Plugin by Inimist Technologies is one of the most used, stable and trusted CakePHP captcha plugin support since 2009. We have maintained CakePHP Captcha support throughout these long years and we are still committed to maintain it as long we found it useful for the large community of CakePHP framework.

Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/inimist/public_html/vendor/cakephp/cakephp/src/View/Helper/FormHelper.php on line 2022

CakePHP Image Captcha Demo

Can't read? Reload
[Using default theme. Use random theme for variations]

{Source Code: CakePHP Captcha, Image Challenge}

(Code with yellow background in the source code below indicates the only changes to your application)

Call Captcha behavior in the model ie Table class UsersTable.php in this example

public function initialize(array $config)
	$this->addBehavior('Captcha.Captcha', ['field'=>'captcha_input_field_name']);

Place in form, in view file register.ctp in this example

<?= $this->Form->create($user, ['novalidate']) ?>
		<legend><?= __('CakePHP Image Captcha Demo') ?></legend>
		echo $this->Form->input('name');
		echo $this->Captcha->create('captcha_input_field_name', [
		'theme'=>'random' //two themes, "default" and "random",
	<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
<script src=""></script>
	jQuery('.creload').on('click', function() {
		var mySrc = $(this).prev().attr('src');
		var glue = '?';
		if(mySrc.indexOf('?')!=-1) {
			glue = '&';
		$(this).prev().attr('src', mySrc + glue + new Date().getTime());
		return false;

Call Captcha component in the initialize function of the conroller, UsersControllerr.php in this example

public function initialize()

Place in UsersControllerr.php action, "register" here

public function register()
	$user = $this->Users->newEntity();
	if ($this->request->is('post')) {
		$this->Users->setCaptcha('captcha_input_field_name', $this->Captcha->getCode('captcha_input_field_name'));
		$user = $this->Users->newEntity($this->request->getData());
		if ($user->errors()) {
			$this->Flash->error(__('Validation failed.'));
		}	else	{
			$this->Flash->success(__('Validation success.'));

That should be it!

If you should have any proble, question, comment, feedback or any suggestion for CakePHP Captcha Plugin please feel free to drop us a message at one of our contact us page or at Github