Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Installation of Yii 2.0 Framework

    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 527
    Comment on it

    Hello Friends, My first blog on Yii Framework Yii : A Futurisitic Framework was about an introduction of Yii 2.0 framework and its features. To explore those marvellous features and to test them practically, Let's give a try to Yii 2.0 Framework. The first step towards this is How to install Yii framework 2.0 ?. The standard installation installed the Yii framework with basic project template. A project template is a working application with some basic features. Yii also provides another project template "Advanced Project Template" which can be better suited for team development environment to develop applications with multiple tiers.

     

    There are two ways for installing Yii framework :

    1. Using Composer

    2. Using Archive File

     

    1. Installation Using Composer :

    This is the recommended method for installing Yii 2.0 framework, If composer is already installed on your system, You can skip Step 1 and start from Step 2 and If composer is not installed follow the steps given below :

    Step 1 : Installing Composer :

    (i) On Linux and Mac OS X Systems run the following commands :

    curl -sS https://getcomposer.org/installer | php
    mv composer.phar /usr/local/bin/composer

     

    (ii) On Windows System :

    For windows system, download and install Composer-setup.exe.

    Note : Please make sure you are using upto date version, To update composer run the command composer self-update. For more instructions you can visit getcomposer.org.

     

    Step 2: Installing "composer asset plugin" :

    This is an optional plugin which allow us to manage project assests (css, js etc) using composer without installing NPM and Bower packages. To install plugin run the below command :

     

    composer global require "fxp/composer-asset-plugin:~1:1"

     

    Note : This command has to run once. During installation it can be asked to enter your GitHub account details (Username & Password).

     

    Step 3 : Installation of Yii Framework :

    Step 3.1 : Move to your webroot folder for installing yii2 basic and advance templates.

    (a) On Linux System : cd /var/www/html/

    (b) On Windows : cd c:\wamp\www\
    Note : I have used wamp, So the root directory is www.

     

    Step 3.2 : To install Yii 2.0 framework with project templates, Run the below commands as per your requirements. Basic project template is better to use in start, It is suitable for most of the web applications.

     

    (a) For basic template :

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

     

    The above command install Yii with basic template inside basic directory, You can change directory name by changing basic with different directory name.

     

    (b) For advanced template :

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

     

    The above command install Yii with advanced template inside advanced directory, You can change directory name by changing advanced with different directory name.

     

     

    2. Installation Using Archive File :

    This is an another way to install Yii 2.0 framework, The steps are given below :

    Step 1 : Download the archive file from www.yiiframework.com/download/ under (Install from an Archive File Section) with the choice of your project template.

     

    Step 2:

    (a) Create a new folder for your application (basic) inside root directory.
    (b) Unzip the downloaded zip file inside test folder.

     

    Step 3 : Enter the secret key for the cookieValidationKey inside config/web.php file. .

    Note : cookieValidationKey automatically set if installing using composer.

     

     

    Verify the Installation :

    Yii also have built-in web server, You can check the installation by following ways :

    1. Using built-in server :

    Step 1: Start server :

    (a) Open terminal/command-prompt and Go to project directory
    (b) Run the given command to start server :

    php yii serve

    (c) Load this url on your browser http://localhost:8080/. you can see the congratulations page in your browser.


    2. Using localhost(Apache server) :

    If not using built-in server, we can also access application by browsing given url :
    http://localhost/basic/web/

     

    You can also setup an Yii application using other methods such as Building Application from Scratch and By installing The Advance Project Template for which detailed instructions are provided on Installing Yii.

     

     

     

     

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: