In this post i will explain the Basic features and installation of Yii Framework. A web application framework (WAF) is a software framework that is designed to support the development of dynamic websites, web applications, web services and web resources. The framework aims to alleviate the overhead associated with common activities performed in web development. For example, many frameworks provide libraries for database access, templating frameworks and session management, and they often promote code reuse.


Yii installation in windows

  • Download the latest version / most stable
  • Extract at your most comfortable path (e.g. c:\framework)
  • Register the path were your php.exe reside at Window Environment Variables (e.g C:\Wamp2.4\bin\php\php5.4.16)
  • Logoff windows to take effect
  • Create application in windows click Start->Run then keyin cmd at the console environment type this based on the given example “c:\framework\yiic webapp wamp2.4\www\name_of_the_application”

History of Yii Framework

The Yii project started on January 1, 2008, in order to fix some drawbacks of the PRADO framework. For example, in its early versions PRADO was slow when handling complex pages, had a steep learning curve and many controls were difficult to customize, while Yii was much more efficient at that time.[4] In October 2008, after ten months of private development, the first alpha version of Yii was released. On December 3, 2008, Yii 1.0 was formally released.

Features of Yii Framework

  1. Model-View-Controller (MVC) design pattern.
  2. Generation of complex WSDL service specifications and management of Web service request handling.
  3. Internationalization and localization (I18N and L10N). It supports message translation, date and time formatting, number formatting, and interface localization.
  4. Layered caching scheme. It supports data caching, page caching, fragment caching and dynamic content. The storage medium of caching can be changed.
  5. Error handling and logging. Errors are handled and presented more nicely, and log messages can be categorized, filtered and routed to different destinations.
  6. Security measures include cross-site scripting (XSS) prevention, cross-site request forgery (CSRF) prevention, cookie tampering prevention, etc.
  7. Unit and functionality testing based on PHPUnit and Selenium.
  8. Automatic code generation for the skeleton application, CRUD applications, etc.
  9. Code generated by Yii components and command line tools complies to the XHTML standard.
  10. Carefully designed to work well with third-party code. For example, it’s possible to use code from PEAR or Zend Framework in a Yii application.

Directory structure

The basic application does not divide application directories much. Here’s the basic structure:

  • assets – application asset files.
  • AppAsset.php – definition of application assets such as CSS, JavaScript etc. Check Managing assets for details.
  • commands – console controllers.
  • config – configuration.
  • controllers – web controllers.
  • models – application models.
  • runtime – logs, states, file cache.
  • views – view templates.
  • web – webroot.