Installing Yii 2 framework in windows and ubuntu

Installing Yii 2 framework in windows and ubuntu
Reading Time: 2 minutes

Installing Yii 2 framework is very much simple than other frameworks. You can install Yii in two ways, using the Composer package manager or by downloading an archive file. The former is the preferred way, as it allows you to install new extensions or update Yii by simply running a single command

Installing Yii 2 framework in windows

First, install composer for windows from here. Download Link

After installing composer move the directory to htdocs by using cd xampp/htdocs command in cmd. after that run below command in cmd

After this run this command to download Yii 2

This will start installing Yii 2 framework on your machine. It will ask for your GitHub token, which you can generate from your GitHub account. Click here to know how to generate tokens in Github.

After entering GitHub token, your fresh Yii installation will be ready.


Steps to install Yii 2 in ubuntu

I will guide you Installing Yii 2 framework in ubuntu using composer. First, we have to install curl in order to install composer. To install curl we have install two packages. Type the following command in terminal.

You will be asked to type yes for confirmation to continue installation.

Now download the composer by typing the following command.

Now we will install the composer globally.

Now you can use composer by typing “composer” and “some command” with it.

Let’s use Composer to install Composer asset plugin. “The Composer Asset Plugin allows you to manage project assets (CSS, js, etc.) in your composer.json without installing NPM or Bower.” Copy -> paste the following command into your terminal, and execute it.

Install some recommended package of PHP, It will be needed once during the first-time installation of Yii 2. If you have already installed these packages then you don’t need to install again.

Now we can start installing Yii 2 framework project. During installation of Yii 2, your GitHub username and password will be required. Now move to your localhost web root folder. If you are using lamp you can move with this command :

To install yii2 basic theme, type the below command:

After successful download of Yii 2, you can rename the folder. To open the project type the following command in terminal


Leave a Reply

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