yii2

How can I call a console command in web application in Yii 2.0


I have a console command to generate user report. I want to call the same from my web application. I am using Yii 2.0.0 beta version.I tried to follow answers given in this post How to call a console command in web application action in Yii?

Since Yii 2.0 structure is very different from Yii 1.1 ,I get errors if I try to include command/userReportController.php .Can someone guide me on this?


Solution

  • You should use an extension like https://github.com/vova07/yii2-console-runner-extension