Making a simple web app with Yii framework
This is a very old tutorial and may not be applicable to the latest version at all.
Today we are going to learn how to make use of the Yii framework and make a web app. I have been doing a bit of reading at my office on different frameworks available for PHP and in the end, the decision was Yii. So, will be diving into the Yii framework and check the possibilities. To accomplish this tutorial, I assume you have Apache, MySQL and PHP installed on your system. There are a lot of frameworks available for PHP and a lot of them rely completely on the command line for most of the work. But Yii has a nice GUI for the same which was a big advantage… at least I don’t like the black screen too much personally speaking. ?
Ok, you can download the latest version of Yii framework from http://www.yiiframework.com/download/
There are two important things that you need to do before continuing with the tutorial and that is to set the path for PHP and yii in the environment variables. I have WAMP installed on my machine.
To get to the environment variables Right click on My Computer -> Properties -> Advanced settings ->
The php.exe should be inside the wamp\bin\php\php5.3.5 folder or relevant PHP version folder which you need to locate yourself as it will depend on your version. But the basic thing is the same.
Once done, extract the file with the Yii framework. I have placed the file and extracted it on my wamp folder which is c:\wamp\www\yii I would suggest you too to maintain the same path at first so that you don’t have any problem following along.
Once done, open your command line by going into the start menu -> run -> cmd. The black screen will come and we need to change our directory to your main www folder (for wamp). See the screenshot of my command line window for reference.
Once there, you just need to type in some bit of command in command line and bingo you will be done
So, the magical command is
yiic webapp [projectname] in my case yiic webapp mydemo
Once done, it will ask you if you want to create the application or not. Type “Y” and press enter… some files are created and BINGO.
Hope this tutorial helped you with the basics of Yii framework.