Create Custom Helper and call from view in cakephp 3.x

To create a custom helper in cakephp first create a file in Helper folder and Helper classes should be suffixed with ‘Helper’.

example- (YourProject/src/view/Helper/CustomHelper.php)

CustomHelper.php is our new helper with Helper suffix.

Now in CustomHelper.php you can create function like this example

<?php
namespace App\View\Helper;

use Cake\View\Helper;

class CustomHelper extends Helper {


	
	public function yourhelperfunction()
	{		
		//your function code here
	}
}
?>

How to call custom helper function in view file

To call custom helper function from view file use

  $getresponse = $this->Custom->yourhelperfunction();