Install Yii 2

Install Yii 2 via composer

1. Install composer from here https://getcomposer.org/doc/00-intro.md
Add its path in environment in windows or move to /bin/composer in Ubuntu to make it run globally.

2. Run the following commands

 composer global require "fxp/composer-asset-plugin:1.0.0-beta3"
 composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application

yii-application is the name of the dir where you want to install the application. Its an advanced app. you can specify yii2-app-basic to create basic app.

3. Initialize directory structure
cd to yii-application dir and run.

  php init

select 0 as dev environment. This command creates the basic structure of the directories.

4. Connect DB
Create a new database and adjust the components.db configuration in common/config/main-local.php accordingly.

5.
Apply migrations with console command yii migrate.

6.
Set document roots of your web server:
for frontend /path/to/yii-application/frontend/web/ and using the URL http://frontend/
for backend /path/to/yii-application/backend/web/ and using the URL http://backend/

🙂

Leave a Comment

Your email address will not be published. Required fields are marked *