Yii Framework


Published on

Yii Framework - DPUG November 2009

Published in: Technology, Education
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Yii Framework

    1. 1. Yii Web Programming Framework easy, efficient and extensible Jason Ragsdale - 11/17/2008
    2. 2. About Yii Yii is a high-performance programming framework for developing Web applications in PHP 5. It enables maximum reusability in Web programming and can significantly accelerate the development process. The name Yii (pronounced as [i:]) stands for easy, efficient and extensible. Yii is easy to learn and use. You only need to know PHP and object-oriented programming. You are not forced to learn a new configuration or templating language. Yii is extremely fast. Its overhead to applications written on top of it is negligible. As a matter of fact, it is one of the most efficient PHP frameworks around. Yii is highly reusable and extensible. Yii is purely object-oriented. Everything in Yii is a self- contained component which can be configured, reused or extended easily.
    3. 3. More About Yii Yii comes with a rich set of features. From MVC, DAO/ActiveRecord, to theming, internationalization and localization, Yii provides nearly every feature needed by today's Web 2.0 application development. Yii has very detailed documentation. From the definitive guide to class reference, Yii has every information you need to quickly learn and master it. Yii is carefully designed from the beginning to fit for serious Web application development. It is neither a byproduct of some project nor a conglomerate of third-party work. It is the result of the authors' rich experience of Web application development and the investigation and reflection of the most popular Web programming frameworks and applications. Last but not least, Yii is free! Yii uses the new BSD license, and it also ensures that the third- party work it integrates with use BSD-compatible licenses. This means it is both financially and lawfully free for you to use Yii to develop either open source or proprietary applications.
    4. 4. Performance of Yii Yii is a high-performance framework. The table below shows how efficient Yii is when compared with other popular PHP frameworks. The RPS numbers describe how many requests an application written in a framework can process per second. The higher the number, the more efficient the framework is. RPS RPS with APC Symfony 1.1.2 20 36 Zend 1.6.1 38 51 Prado 3.1.2 19 53 CodeIgniter 1.6.3 78 131 CakePHP 1.2.0 56 170 Yii 1.0 92 178 Solar 1.0 99 190 Yii with yiilite 1.0 63 427 0 125 250 375 500 http://yiiframework.com/performance/
    5. 5. Performance of Yii Benchmark Applications A benchmark application is written for each framework. Each application simply tries to display a string "hello world". Any additional framework features are disabled to ensure fairness of the comparison. You may download the complete benchmark applications to verify. The goal of this benchmarking is to reveal the RPS upper limit (or the minimal overhead) of each framework without using any additional server caching techniques. Therefore, each application is written such that a single die('hello world'); statement is placed in the default controller action of each application. We do not invoke the complete view rendering logic of each framework because that will be slower and will not give us the RPS upper limit. As a matter of fact, for actions responding to AJAX requests, complete view rendering logic is seldom used. Benchmark Setup The RPS numbers were obtained using the ApacheBench tool with the command "ab -t 30 -c 10 URL" (i.e., at currency level 10 running the test for 30 seconds). To get each number, we first stop and then start the Apache Web server to avoid interference. The testing environment is as follows: * Operating System: Red Hat Enterprise Linux Server release 5.2 * Web Server: Apache httpd 2.0.40 * PHP: 5.2.6, any non-essential extensions are disabled * CPU: Dual Intel Xeon 3.2GHz * Main Memory: 2GB * Hard Drive: 73GB 15K RPM SCSI/SAS HDD
    6. 6. Features Yii comes with a full stack of features needed by today's Web 2.0 application development. Below is a short list of these features. * Model-View-Controller (MVC) design pattern: Yii adopts this proven technique in Web programming which can better separate logic from presentation. * Database Access Objects (DAO) and Active Record: Yii allows developers to model database data in terms of objects and save their effort of writing long and repetitive SQL statements. * Integration with jQuery: as one of the most popular JavaScript framework, jQuery enables writing highly efficient and versatile JavaScript interfaces. * Form input and validation: Yii makes collecting form input extremely easy and safe. Yii comes with a set of validators which can be used to ensure validity of input data, and it also has helper methods and widgets to indicate errors when validation fails. * Web 2.0 widgets: powered by jQuery, Yii comes with a set of Web 2.0 widgets, such as auto- complete input field, treeview, and so on. * Authentication and authorization: Yii has built-in authentication support. It also supports authorization via role-based access control (RBAC). * Theming: it enables change of the outlook of an Yii application instantly. d and routed to different destinations.
    7. 7. more Features * Web services: Yii supports automatic generation of complex WSDL service specifications and management of Web service request handling. * Internationalization (I18N) and localization (L10N): Yii supports message translation, date and time formatting, number formatting, and interface localization. * Layered caching scheme: Yii supports data caching, page caching, fragment caching and dynamic content. The storage medium of caching can be changed easily without touching the application code. * Error handling and logging: errors are handled and presented more nicely, and log messages can be categorized, filtered and routed to different destinations. * Console applications: Yii provides powerful command line tools to automate generation of code. It also facilitates development of custom console applications. * Purely object-oriented: Yii framework sticks to strict OOP paradigm. No global functions or variables. It is easy to extend Yii and use Yii with other third-party libraries. * Detailed documentation: every single method or property is clearly documented. A comprehensive tutorial is also provided together with other minor tutorials. * Extension library: Yii provides an extension library consisting of user-contributed components. This makes the above feature list never ending.
    8. 8. Active Record Although Yii DAO can handle virtually any database-related task, chances are that we would spend 90% of our time in writing some SQL statements which perform the common CRUD (create, read, update and delete) operations. It is also difficult to maintain our code when they are mixed with SQL statements. To solve these problems, we can use Active Record.
    9. 9. Widgets AutoComplete Captcha Flex HtmlPurifier (htmlpurifier.org) Masked Text Fields Multi-file upload Output Caching Star Rating Tab View Text Highlighter Tree View
    10. 10. Credits Yii incorporates many ideas and work from other well-known Web programming frameworks and applications. Below is a short list. * Prado: This is the major source of ideas for Yii. Yii adopts its component-based and event- driven programming paradigm, database abstraction layers, modular application architecture, internationalization and localization, and many others. * Ruby on Rails: Yii inherits its spirit of conventions over configurations. Yii also referenced its implementation of active record design pattern. * jQuery: This is integrated in Yii as the foundational JavaScript framework. * Symfony: Yii referenced its filter design and plug-in architecture. * Joomla: Yii referenced its modular design and message translation scheme. this was a nice presentation but we don't guarantee anything was true, Oh and You can see Alaska form here.