Using custom helper in command

I want to use a custom helper in a custom command. From :

it appears I need to :

  1. create my helper in src/command/helper instead of view//helper
  2. Call it with :


However when I do this I get:

Call to undefined method App\Command\myCommand::helper()

Did I misunderstand something? It seems that helper is not defined?


I haven’t used this functionality, but I wonder if there’s an issue in the docs. The large majority of examples on the page you linked use $io->helper(), so it would seem to be a function of the ConsoleIo class, not the command class. $this->helper() maybe a typo.

As Zuluru said, apparently the right way to call a command helper is this way:

$io->helper('Heading')->output(['It works!']);


Were test is the name of the command and Heading the name of the command helper

I have tested this and it works this way