2.8.4.4.1. Installing Yii 2

Attention!

During installation, the following text will be displayed in the console on a yellow background:
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/

This is not a bug, just a notification that an old version of Composer is being used.

  1. Connect to hosting via SSH.
  2. Install Composer version 1.x (Yii 2 does not support Composer 2.x).
  3. Go to your site directory:
    cd ~/example.com
  4. Install Composer Asset Plugin (manages bower and npm package dependencies):
    composer global require "fxp/composer-asset-plugin:^1.4.6"
  5. If you are not registered on GitHub, register, then go link and create a token to access the repositories (may be needed during installation).
  6. Install Yii 2 and set up the root directory:
    1. To install the Yii 2 Basic Application Template, run the command:
      composer create-project yiisoft/yii2-app-basic www

      Instead www specify the path to the subdirectory where the framework is installed.

    2. V site settings as root directory indicate web.
    1. To install the Yii 2 Advanced Application Template, run the commands:
      composer create-project yiisoft/yii2-app-advanced www
      php www/init

      In each of the teams, instead of www specify the path to the subdirectory where the framework is installed.

    2. V site settings as root directory indicate frontend/web.
  7. Wait a few minutes and check if the site is working.
Content