O'Reilly logo

Yii2 By Example by Fabrizio Caldarelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a console controller

A console controller is totally similar to the web controllers that we created earlier. It extends the \yii\console\Controller base class and can return an integer value indicating the status response of the action (0 stands for successful execution of the action), also named exit code.

The public properties of the controller can be made available as an option only if their names are returned by the options() method that accepts actionID as the parameter; so the response can be customized according to actionID.

The response of the options() method is an array of text string that represents the public property names of the controller.

Starting from the advanced template application that we previously installed in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required