Configuring Gii
While Active Record models and forms can be generated by hand, in most cases, we'll want to automate the creation of this code. To achieve this, Yii2 provides a code generation tool called Gii, which can be executed both from the command line and from a web interface in order to create Active Record models that work with our database structure and forms that work with both our base models and Active Record models.
Unlike Yii1, Gii does not come prebundled with Yii2. In Yii2, nearly every module is available as a separate Composer package, which can be installed from the command-line interface. Consequently, we must use Composer to include Gii in our application. Since Gii is available as a composer package, we can include it in our application by running the following command from our command line:
$ composer require yiisoft/yii2-gii --dev
Tip
Since Gii is a development tool and has the ability to write new code to our application, we should use the --dev
flag so that Composer...