2.8.4.4.1. Install Yii 2

Attention!

During installation, the following text will appear 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 an error, but simply a notification that an older version of Composer is being used.

  1. Connect to the hosting via SSH.
  2. Install Composer version 1.x (Yii 2 does not support Composer 2.x).
  3. Go to your site's catalog:
    cd ~/example.com
  4. Install the Composer Asset Plugin (manages dependencies for Bower and npm packages):
    composer global require "fxp/composer-asset-plugin:^1.4.6"
  5. If you haven't signed up for GitHub yet, please do so, then follow this link and create a token to access the repositories (you may need it during installation).
  6. Install Yii 2 and configure the root directory:
    1. To install the Yii 2 Basic Application Template, run the following command:
      composer create-project yiisoft/yii2-app-basic www

      Replace www with the path to the subdirectory where the framework is installed.

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

      In each of the commands, replace www with the path to the subdirectory where the framework is installed.

    2. In the site settings, specify frontend/web as the root directory.
  7. Wait a few minutes and check if the site is working.
Tabla de conținut