Install Yii2 Application Tutorial

Install Yii2 Application

In my previous article I explain about some of the major changes in Yii2 Framework. In this article I will guide you to install and setup the configuration web application using Yii2 framework.

One of the new feature in Yii2 is the introduction of Composer.

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

We can install Yii2 framework and application using composer. Using composer is very easy and I insist those who havn’t used composer should start using it. Though if you are not intending to use composer you can download Yii2 and install it the same way as in Yii1. I will first explain how to install Yii2 using composer and then the normal download.

Install Yii2 using composer

You need to install Composer inorder to user composer. If you are on Linux or Mac you can install it by executing the following code

In Windows you can download the executable installer here. Download and install it. When you install you can choose to add menu item to the right click menu.

With Composer installed, you can install Yii by running the following command under a Web-accessible folder:

The above command installs Yii in a directory named basic.

Tip: If you want to install the latest development version of Yii, you may use the following command, which adds a stability option:

Note that the development version of Yii should not be used for production as it may break your running code.

Installing from an Archive File

Installing Yii from an archive file involves two steps:

  1. Download the archive file from Yii 2 with basic application template or Yii 2 with advanced application template.
  2. Unpack the downloaded file to a Web-accessible folder.
  3. Modify the config/web.php file by entering a secret key for the cookieValidationKey configuration item (this is done automatically if you are installing Yii using Composer):

 

Verifying the Installation

After installation, you can use your browser to access the installed Yii application with the following URL:

Install Yii2 Application
Install Yii2 Application

 

You can check if the minimum requirements are met using one of the following approaches:

  • Use a browser to access the URL http://localhost/basic/requirements.php

 

2 thoughts on “Install Yii2 Application Tutorial”

  1. I Am confused about cookie validation key.

    Kindlty guide me where from i can get it?

    No idea i am black here thats why stuck with yii installation from zip.

    Thankyou in advance.

Leave a Reply