Home » Install Methods » How to install Yii2

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 is two type 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 on 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 composer. If you do not already have Composer installed, just follow the instruction on our post how to install composer  . If you had Composer already installed before, make sure you use latest version. You can update Composer by running

composer self-update

Installing Yii2 basic application

To install Yii2 basic app you need to run below commond 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 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 process in Generate Github token .

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

 

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

Installing Yii2 advanced application

Let’s start with advanced app, like basic app we need 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 download process completd. You need to run below commands:

cd advanced

This command take us in abvanced directory then we need to following command:

php init 

After run this command you have to set environment there is two option aviable

[0] Development      [1] Production

As you can see in figure(2) .

figure(2) .

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

Let’s see it in 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