Short instruction. How to install Yii2 advanced

July 24, 2017 25 Yehor Rykhnov

Short instruction on how to install Yii 2 advanced in Windows on OpenServer.

Because The instruction is brief, then a detailed description of what the commands do in the instruction will be omitted.

For Yii2 you should have a version of PHP 5.4 or higher.

Preparing to install Yii2 advanced

The next steps are done once before the first installation of the project on Yii2.

If you first install the project on Yii 2, then first you need to create a token on github. How to do this is described here: кодер.укр/записи/yii-framework-2-как-я-устанавливал-yii2 at the beginning of the article, after adding the token, go back.

Next, execute the command in the console:

composer global require "fxp/composer-asset-plugin:~1.0.3"

Installing Yii2 advanced

1. Open the console and go to the folder of projects:

cd domains

2. Next, run the command:

composer create-project --prefer-dist yiisoft/yii2-app-advanced my-project-name.local

Where my-project-name.local is the folder where you want to install Yii 2.

3. Wait until everything is installed, after which move to the project folder and initialize the project, with next commands:

cd my-project-name.local
php init

4. Select Development (0), for this we press 0, confirm our choice, enter y press Enter and wait until the initialization takes place.

5. Next, create a database for the project.

6. Configuring a database connection in a file /my-project-name.local/common/config/main-local.php:

'db' => [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yourDBName',
    'username' => 'root',
    'password' => '',
    'charset' => 'utf8',
],

7. Run the migration:

yii migrate

That's all, the project is ready to work.

Article source: кодер.укр/записи/как-установить-yii-2-advanced-краткая-инструкция.