Yii framework tutorial for Beginners: How to use Yii to create first App

Discussion in 'Yii Tutorials' started by readerspark, Sep 27, 2013.

  1. readerspark

    readerspark Administrator Staff Member

    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:\wamp\www (your codes are saved inside protected folder)

    You can find demo projects in C:\wamp\www\yii framework folder name\demos\

    Example my location is: C:\wamp\www\yii\demos\blog\protected

    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 Panel\System and Security\System

    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:\wamp\www\yii\framework;C:\wamp\bin\php\php5.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 wamp\www
    type C:\wamp\www>yiic
    There are four types of commands available

    message
    migrate
    shell
    webapp

    If you want to create web app so type
    Code:
    C:\wamp\www>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:wamp\www\firstapp’? [yes|No]
    type yes

    Finally it show : “Your application has been created successfully under c:\wamp\www\firstapp”.

    In C:\wamp\www\firstapp\protected 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:\wamp\www\firstapp\If your application created in Yii framework folder, you will defiantly get this kind of error.
  2. Nice tutorial. I begin to learn yii. Hope you publish new tutorial soon...
  3. Nice post. Thanks

Share This Page