Home » Install Methods » How to install Yii2 on windows

Introduction: Yii2 is the fast-growing PHP framework. It has a lot of features like client-side and server-side validations, debug tools and a lot of extensions to work easier. It is the best framework for bigger websites.

Summary: There are two types of apps available to download Yii2 one is Basic which is useful for the small website which has no more panel only has frontend. Another one is Advanced which is useful for projects which have more than one panel. In this post, I am going to download both basic and advanced app.

Let’s start, first of all, we need the Composer. If you do not already have Composer installed, just follow the instruction on our post how to install composer.  If you had the Composer already installed before, make sure you use the latest version. You can update the Composer by running

composer self-update

Installing Yii2 basic application

To install Yii2 basic app you need to run below command into your XAMPP, WAMP or any server that you are using for your localhost:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

Make sure you do not have a basic folder in your directory. My localhost path in E drive and I am using XAMPP as you see in figure(1).

figure(1)

At the last in command basic is the directory name where you want to install a Yii2 basic app you can change it.

NOTE: Some time installing process need  Github token you can see the process to Generate Github token.

Once the installation process is completed you need to open your browser with this path http://localhost/basic/web/

 

If you are able to see the above image congratulations! Yii2 basic app installed successfully.

Installing Yii2 advanced application

Let’s start with the advanced app, like the basic app we need the same requirement composer for. You can then install the advanced application using the following commands:

composer create-project --prefer-dist yiisoft/yii2-app-advanced advanced

Again in the last of the command advanced is the directory name you can change the name of it .

After the download process completed. You need to run below commands:

cd advanced

This command takes us in the advanced directory then we need to the following command:

php init 

After running this command you have to set the environment there is two option available

[0] Development      [1] Production

As you can see in figure(2).

figure(2) .

You need to select 0 then it confirms for ‘Development’ environment, you need to type yes and press Enter. Your installation completed now.

Let’s see it in the browser for frontend  type localhost/advanced/frontend/web/  into you browser URL bar as you can see in figure(3)

figure(3)

For backend type localhost/advanced/backend/web/

That’s all! 😊
Still, face any problem you can contact us we definitely help you

How to install Composer
How to install laravel

Back to top