yii PHP Framework

Published on June 2016 | Categories: Types, Government & Politics | Downloads: 34 | Comments: 0 | Views: 1011
of 24
Download PDF   Embed   Report

Musa TalukdarSoftware Engineer9th feb,2012About Yii‡ free, open-source Web application development framework written in PHP5 ‡ brainchild of its founder, Qiang Xue ‡ You have full control over the configuration from head-to-toe ‡ Fast, secure, professionalCredits‡ Prado: Yii adopts its component-based and eventdriven programming paradigm, database abstraction layers, modular application architecture, internationalization and localization, and many of its other features and patterns. ‡

Comments

Content

Musa Talukdar
Software Engineer
9th feb,2012

About Yii
‡ free, open-source Web application development framework written in PHP5 ‡ brainchild of its founder, Qiang Xue ‡ You have full control over the configuration from head-to-toe ‡ Fast, secure, professional

Credits
‡ Prado: Yii adopts its component-based and eventdriven programming paradigm, database abstraction layers, modular application architecture, internationalization and localization, and many of its other features and patterns. ‡ Ruby on Rails: Yii referenced its implementation of the active record design pattern for its ORM layer. ‡ 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.

Features
‡ ‡ ‡ ‡ ‡ ‡ ‡ ‡ MVC Database Access Object Form validation Authentication and authorization Skinning and theming Web service i18N and L10n Layered cashing scheme

Features
‡ ‡ ‡ ‡ ‡ ‡ ‡ Error handling and logging Security Unit and functional testing Automatic code generation Friendly with third-party code Detailed documentation Extension library

MVC

Database Access Objects (DAO), Query Builder, Active Record, DB Migration
‡ Data Access Object(DAO)
 Build on top of PHP Data Object  enables accessing to different database management systems (DBMS) in a single uniform interface.  easily switched to use a different DBMS without the need to modify the data accessing code

Database Access Objects (DAO), Query Builder, Active Record, DB Migration
‡ Yii Query Builder
 object-oriented method for building queries  helps reduce risk of SQL injection attacks

‡ Yii Active Record(AR)
 implemented as a widely adopted ObjectRelational Mapping (ORM) approach Representing a table in terms of a class and a row an instance eliminates the repetitive task of writing those SQL statements that mainly deal with CRUD (create, read, update and delete) operations.

example of an AR insert
CREATE TABLE tbl_post ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, title VARCHAR(128) NOT NULL, content TEXT NOT NULL, create_time INTEGER NOT NULL ); $post=new Post; $post->title='sample post'; $post->content='post body content'; $post->save();

Form input and validation
‡ form helper to create form using php ‡ Form validation using ajax ‡ display appropriate error messages for invalid input

Authentication and authorization
‡ built-in authentication support ‡ authorization via hierarchical role-based access control (RBAC).

Skinning and theming
‡ Yii implements a skinning and theming mechanism that allows you to quickly switch the outlook of a Yii-power website. ‡ While using a theme we can quickly change the outlook of views, we can use skins to systematically customize the outlook of the widgets used in the views.

Internationalization (I18N) and localization (L10N)
‡ locale data for each possible language and variant. ‡ message and file translation service ‡ locale-dependent date and time formatting. ‡ locale-dependent number formatting.

Layered caching scheme
‡ Yii supports
Data caching Query Caching Page caching Fragment caching Dynamic content caching

‡ The storage medium of caching can be changed easily without touching the application code.

Layered caching scheme
CMemCache: uses PHP memcache extension. CApcCache: uses PHP APC extension. CXCache: uses PHP XCache extension. CEAcceleratorCache : uses PHP EAccelerator extension . CDbCache: uses a database table to store cached data. By default, it will create and use a SQLite3 database under the runtime directory. You can explicitly specify a database for it to use by setting its connectionID property. CZendDataCache: uses Zend DataCache as the underlying caching medium. CFileCache : uses files to store cached data. This is particular suitable to cache large chunk of data (such as pages).

Security
‡ Cross-site Scripting Prevention using
 HTML Purifire

‡ Cross-site Request Forgery Prevention  CHtml::form method will embed the necessary random value in a hidden field so that it can be submitted for CSRF validation ‡ Cookie Attack Prevention  Yii implements a cookie validation scheme that prevents cookies from being modified.

Testing
‡ unit and functional testing ‡ The testing supported provided by Yii requires PHPUnit and Selenium Remote Control ‡ The most basic unit is function ‡ Functional test on module ‡ Create the required file structure for testing

Automatic code generation
‡ Yii provides a set of intuitive and highly extensible code generation tools that can help you quickly generate the code you need for features such as form input, CRUD.

And many more
‡ ‡ ‡ ‡ Module Component Web service Extension library

let's get our hands dirty

let's get our hands dirty
1. 2. 3. 4. Install Yii Create database Generate model and CRUD Customize your code done

Refercnce
‡ ‡ ‡ ‡ http://www.yiiframework.com/ http://en.wikipedia.org/wiki/Yii http://www.phpframeworks.com Yii 1.1 Application Development Cookbook

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close