Yii 2 - Installation basic and advanced application templates via Composer


Yii 2 provides an opportunity to begin the development of a new project with prepared "skeleton". You can choose between two application templates: basic and advanced. Their differences and installation will be discussed in this article.

The basic application template is a "simplified" procurement for the future project. This template is already a structured code base, which has one example controller, model and two forms. This is where you can start a new project, or just study this framework.

Also Yii 2 provides another, more extended application template called "advanced". From basic it differs more sweeping structure, oriented to a more serious project.

Which one to choose depends on the size of the future project. Further will be discussed about installing both application templates via Composer.

Installing a basic or advanced application template

  1. Make directory for a new project and go in it (path /var/www/ you can have another):

    $ mkdir /var/www/yii2-new-app && cd $_
  2. With composer, create in the new directory basic or advanced the Yii 2 framework project (this command means that the composer is installed globally)

    $ composer create-project yiisoft/yii2-app-basic ./
    # or
    $ composer create-project yiisoft/yii2-app-advanced ./
  3. Run the built-in PHP web-server:

    $ ./yii serve
  4. Open the browser in the address to which the running web-server, by default it is: http://localhost:8080/ The start page of the basic or advanced application template for the Yii 2 framework should open, depending on which one you have installed.