Often when building modern web applications, we need to write background and maintenance tasks to support our main application. These tasks may include things such as generating reports, sending e-mails via a queuing system, or even running data analysis that would cause a web-based endpoint to timeout. With Yii2, we can build these tools and scripts directly into our application by writing console commands or even complete console applications.
The basic structure of Yii2 console applications is very similar to the structure used in web applications. In Yii2, console commands that extend from
yii\console\Controller are nearly identical to