How to call helper method in .phtml file

You should not use helper calls directly in the template.
Have your helper instance provided as a dependency to the block that renders the template and create a method in your block that calls the helper and call that method in the template.

Have your block defined like this

protected $helperData;
public function __construct(
     ....
    \{Vendor}\{Module}\Helper\Data $helperData,
    ....
) {
    ....
    $this->helperData = $helperData;
    ....
}

public function doSomething()
{
    return $this->helperData->doSomething();
}

Then you can call in your template $block->doSomething()


You have to use like this:

$helper = $this->helper('{Vendor}\{Module}\Helper\Data');
$values = $helper->YourHelperMethod();

You need to write whole class name in helper as below:

$this->helper('vendorename\modulename\Helper\helpername')

You can use it in phtml file using above code