Yii framework tutorial for Beginners – How to use Yii framework

Yii framework is a best one which cover all futures such as PHP5, MVC, multiple DB’S, ORM, template system, Ajax support, caching, Modules etc.

If you beginning level user who try to learn yii framework, this tutorial is very useful to start your learning in yii framework. lets get started.

First download yii framework in their official Yii framework website. Next unzip downloaded file from zip format.
Store extracted files in your local web sever. In this tutorial i am using WampServer. If you need WampServer, download from Wamp official website.

Here i am already installed WampServer in Windows 7
My local web server root is : C:wampwww (your codes are saved inside protected folder)

You can find demo projects in C:wampwwwyii framework folder namedemos

Example my location is: C:wampwwwyiidemosblogprotected

Step by Step Tutorial guide image to install and run Yii in Windows.

yii tutorial
Click the image to see full preview.

Next you need to assign PHPand Yii framework path.

If you use Windows 7, Goto stat menu->Mycomputer right click and choose properties or directly past this link in your address bar Control PanelSystem and SecuritySystem

Choose Advanced system settings -> In advanced tab choose Environment variables.

In system variables option choose path and click edit button. Type your two paths with “;” separation.C:wampwwwyiiframework;C:wampbinphpphp5.4.3

Here you use any other server app like Xamp and Mamp, find php installed location and yii framework folder location. Set this location in path.

Go to start menu-> run and type cmd . Now your windows command panel is opened.
Type yiic

In Yii framework, they are write one patch file to execute applications. Its automatically generate application as you wish.

Code:
type cd/
type :C:>cd wampwww
type C:wampwww>yiic

There are four types of commands available

message
migrate
shell
webapp

If you want to create web app so type

Code:
C:wampwww>yiic webapp firstapp

Here webapp is application type and firstapp is application name.

It asking a question to create a web app like this Create a web application under ‘C:wampwwwfirstapp’? [yes|No]
type yes

Finally it show : “Your application has been created successfully under c:wampwwwfirstapp”.

In C:wampwwwfirstappprotected folder you can find mode, views, controllers folders
In your browser type: http://localhost/firstapp/.

Now you application are created your first web application. If you got any error check your application location. Here my application created in

C:wampwwwfirstappIf your application created in Yii framework folder, you will defiantly get this kind of error.