Yii and Phalcon – A comparative study

yii vs phalcon

Introduction
In this blog, I present an in-depth, comparative analysis between two top MVC frameworks, YII and Phalcon for PHP. Factors like performance, ease, database handling, ORM and more, have been used to rate them. The intention behind this exercise is to give you a basic picture of ‘Why we choose MVCs for development, and what are the benefits arising from it’. The results are based on both online sources, and my many, day to day experiences at Suyati.

The basics

YiiPhalcon
Yii is a high-performance PHP framework. It is well known for its key features: Fast, secure and high-performance. It is a free and open-source web application development framework written in PHP5 that promotes clean, DRY (Don’t Repeat Yourself) design and encourages rapid development.Phalcon is an open source, full stack framework for PHP5, written as a C-extension, and optimized for high performance. Low-level optimizations provide the lowest overhead for MVC-based applications.

How they work

YiiPhalcon
Yii is much faster, because it uses the lazy loading technique extensively. Going into details, it does not include a class file until the class is used for the first time, and it does not create an object until the object is accessed for the first time. Other frameworks suffer from a performance hit, because they enable functionality, irrespective of whether it is used during a request.Components are loosely coupled. With Phalcon, nothing is imposed on you. It’s free to use as you glue components. It interacts with databases with maximum performance, by using a C-language ORM for PHP. Phalcon directly accesses internal PHP structures, optimizing execution in that way as well.

Performance comparison

YiiPhalcon
Yii framework has a reputation for high-performance. It uses the lazy loading technique extensively. It has powerful caching support. And it is explicitly designed to work efficiently with AJAX.Phalcon is an effort to build the fastest framework for PHP. We now have an even easier and robust way to develop applications with a framework implemented with the philosophy ‘Performance Really Matters’! The compiled nature of Phalcon offers extraordinary performance that outperforms all other frameworks measured in certain benchmarks.

Unit Testing

YiiPhalcon
Yii testing framework is built on top of the PHPUnit. In Yii, the base class CTestCase is meant for generic unit tests, while CDbTestCase is suitable for testing active record model classes. Find more info: http://www.yiiframework.com/doc/guide/1.1/en/test.unitYou need to install PHPunit if not already done, using composer. The Phalcon incubator will help you build the unit tests. Find more info: http://docs.phalconphp.com/en/latest/reference/unit-testing.html

Yii V/s Phalcon – comprehensive comparison

Description/FeatureYiiPhalcon
Multi-user systemYesYes
AutofocusYesYes
Extension/Plug-inYesYes
Image processing enginyes?
InterpreterYes?
Databaseˇ      MySQLˇ      MySQL
ˇ      SQLiteˇ      PostgreSQL
ˇ      MSSQLˇ      SQLite
ˇ      Oracleˇ      MongoDB
ˇ      PostgreSQLˇ      Oracle
TrackbackYes?
Multilingual contentYesYes
Database modelˇ      Relationalˇ      Relational
ˇ      Object-orientedˇ      NoSQL
ˇ      Object-oriented
TransactionsYesYes
UnicodeYesYes
Template languageˇ      PHPˇ      Volt
ˇ      Smartyˇ      PHP
ˇ      Twig
Full text searchYes?
ScaffoldingYesYes
Design patternˇ      Active-Recordˇ      Dependency injection
ˇ      Model-View-Controllerˇ      Model-View-Controller
ˇ      DAOˇ      HMVC
ˇ      HMVC
ˇ      Observer
Development principlesˇ      Convention over configurationˇ      Convention over configuration
ˇ      Test-driven developmentˇ      Don’t repeat yourself
ˇ      Don’t repeat yourself
Difficulty levelˇ      Intermediateˇ      Beginner
ˇ      Intermediate
Object-Relational Mapping (ORM)YesYes
Machine Code GenerationYes?
Documentation levelVery goodVery Good
RESTfulYesYes
Code GenerationYes?
Free to useYesYes
Separate Service LayerYes?
Web FlowsYes?
Community DrivenGoodGood
WSDLYes?
ReliabilityVery Good?
APIGoodGood
Batch ProcessingYes?
Cloud platform supportˇ      Amazon EC2ˇ      Amazon EC2
ˇ      Amazon S3
ˇ      digital ocean
ˇ      ucloud biz
ˇ      OpenShift
ˇ      Windows Azure
ˇ      Google App Engine
Admin GeneratorYes?
Query CacheYes?
RealtimeYes?
Data SecurityYes?
Malicious Injection PreventionYesYes
PerfomanceVery GoodVery Good
Database migrationsYesYes
Debug ModeYesYes
Unit TestingYesYes
AjaxYesYes
Extensions1500+?

Conclusion
It’s clear from my experience that Yii’s performance is excellent. It is easy to configure, use and manage projects in Yii. I am new to Phalcon and in fact Phalcon is a comparatively new framework. So its evaluations and review will not help much at this point. But Phalcon is sure to be a trendsetter in the coming days, because it has almost all the cool features of Yii – and Yii is that accepted.

Read More:
http://www.yiiframework.com
http://phalconphp.com/en/

? – As the framework is new, detailed reviews or feedback to rate it is not available.

Author : Arun Balakrishnan Date : 28 Apr 2014