Yii_v3

Hello world of developers! This is something which I worked on recently and would say that it is apt for the requirements.
As most of you would be aware of Yii framework that is suitable for large and complicated web applications, what I wish to add is that it is amazing when I explored that it provides swift development and provides great flexibility with its component based design and up gradation.

Stating this have documented the step by step process of Yii 2.0 Installation via Composer.

Let’s get Started:

It a cool thing to download the composer if you do not possess.

Download composer from getcomposer.org.

On Linux and Mac OS X:  You’ll need to run the following commands.

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

On Windows: You’ll need to download and run Composer-Setup.exe.

To check the composer installation, Type the below code in command prompt

composer

composer

Once you complete the Composer installation, you can head towards the installation of Yii by running the following commands under a Web-accessible folder:

You could compose this package in the system.

composer global require “fxp/composer-asset-plugin:1.0.0-beta2”

installation

On completion of the composer, You may proceed to:

Type your Github auth access token key during the installation

Set your xampp htdocs directory in the cmd prompt.

Install Advanced Application Template

You have few options to have installed the advanced application template. Look further for the one that is suitable.

To install “advanced application template”, use the following code

composer create-project yiisoft/yii2-app-advanced projAdvanced 2.0.0-beta   

To obtain the up to date amendment:

php composer.phar create-project –prefer-dist –stability=dev yiisoft/yii2-app-advanced /path/to/yii-application

  To obtain the latest and stable during installation:

composer create-project –prefer-dist –stability=dev yiisoft/yii2-app-advanced your_project_name

Install Basic Application Template

Here again you possess few options to install the basic application template, you could pick an option given below.

To install “basic application template”, use the following code

composer create-project yiisoft/yii2-app-basic projBasic 2.0.0-beta  (or)

composer create-project –prefer-dist yiisoft/yii2-app-basic basic_project_name  (or)

composer create-project –prefer-dist –stability=dev yiisoft/yii2-app-basic basic_project_name

Folder Structure of Advanced Application Template

After installed ‘advanced application template’, you will get the application like below folder structure.

yii2 advanced application folder structure:

folder_structure

Root directory contains a set of folder.

  • Backend – backend web application.
  • Common – files common to all applications.
  • Console – console application.
  • Environments – environment config.
  • Frontend – frontend web application.

.gitignore contains a list of directories ignored by git version system. Also note that if you need something never get to your source, instead do the following. 

code repository, add it here.

composer.json – Composer config described in detail below.

init – initialization script described in “Composer config described in detail below”.

init.bat – This is same for Windows.

LICENSE.md – license info. You could put your project license here. Especially when you are opensourcing.

README.md – This is the basic info about installing template. Consider replacing it with information about your project and its installation.

requirements.php – This is the Yii requirements checker.

yii – Well, this is console application bootstrap.

yii.bat – Note this is same for Windows.

Getting Started

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.

Yii2 Installation Via Composer

development_environment

Run command init to initialize the application with a specific environment.

Create a new database and adjust the components[‘db’] configuration in common/config/main-local.php accordingly.

Apply migrations with console command yii migrate. This will create tables needed for the application to work.

Set document roots of your Web server.

Bravo! don’t you think you are successful. Work on it more and get experience the convenience. Also, do not forget to share a comment to state the benefits.