Here goes a quickie to get started with Yii.
Yii is a PHP framework. I won’t go into the very details here, but just be aware that using a framework will help you develop light speed any app that would have taken ages to do without it.
But let see how quick we can start a webapp with the powerful scaffolding tool provided by Yii.
I assume here that you have already installed a viable web environment on your local machine (otherwise…there is no point in reading this). So I guess you have installed WAMP or MAMP or LAMP and that is it running.
Before going further on, the yii command lines we are going to use are using php.exe (yes..the php installed with W/M/L/AMP). In windows, it is necessary to have php in the PATH (environent variable) so that it can be executed from anywhere. If you can’t temper with the environment variables, here goes another way to do it.
Got to yiiframeworkyiic.bat and add the path to phplike this:
set YII_PATH=%~dp0 cd C:wampbinphpblablabla if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe
It must be before the line using PHP_COMMAND.
Beware, if you do that, you will have to redirect the creation of the application. I mean that if you don’t give the path of the webroot when creating the app, all apps will be created in the php.exe’s folder.
It’s also better to have php on your environment variable (PATH), because if you update your yii framework with a new one, you will loose the modification of the yiic.bat file.
Go for it !
First of, go to www.yiiframework.com and download the latest Yii framework file.
What I do here is that I un compressed that file in the root of my webserver (htdocs or www). I then rename the folder into yii (no version, no nothing, just yii).
I’m here in a Windows environment, with the latest version of Wamp I get this :
Now it’s time to try some magic formulas.
Go to the command prompt and navigate to the webroot of your webserver (htdocs or www). We are going to create an application called yiibase.
Type the following command
yiiframeworkyiic webapp yiibase
if you edited the yiic.bat to point to php.exe you MUST specify the path of the web root. The command will be like this then
yiiframeworkyiic webapp c:wampwwwyiibase
A prompt should appear. Type y for yes. BOOoom, there you go ! You should have a lot of lines beginning with
appearing. And now, if you look into your web root folder you’ll see the yiibase folder created.
Got to your favourite browser and type
and voilà. you should see something like this:
There is a lot of documentation on Yii and a lot of tutorials to get you started.
Google it !