O'Reilly logo

Mastering Yii by Charles R. Portwood II

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

Chapter 2. Console Commands and Applications

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.

Configuration and usage

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 yii\web\Controller.

Entry script

Before ...

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