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
Yii | Phalcon |
---|---|
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
Yii | Phalcon |
---|---|
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
Yii | Phalcon |
---|---|
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
Yii | Phalcon |
---|---|
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.unit | You 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/Feature | Yii | Phalcon |
---|---|---|
Multi-user system | Yes | Yes |
Autofocus | Yes | Yes |
Extension/Plug-in | Yes | Yes |
Image processing engin | yes | ? |
Interpreter | Yes | ? |
Database | ˇ MySQL | ˇ MySQL |
ˇ SQLite | ˇ PostgreSQL | |
ˇ MSSQL | ˇ SQLite | |
ˇ Oracle | ˇ MongoDB | |
ˇ PostgreSQL | ˇ Oracle | |
Trackback | Yes | ? |
Multilingual content | Yes | Yes |
Database model | ˇ Relational | ˇ Relational |
ˇ Object-oriented | ˇ NoSQL | |
ˇ Object-oriented | ||
Transactions | Yes | Yes |
Unicode | Yes | Yes |
Template language | ˇ PHP | ˇ Volt |
ˇ Smarty | ˇ PHP | |
ˇ Twig | ||
Full text search | Yes | ? |
Scaffolding | Yes | Yes |
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) | Yes | Yes |
Machine Code Generation | Yes | ? |
Documentation level | Very good | Very Good |
RESTful | Yes | Yes |
Code Generation | Yes | ? |
Free to use | Yes | Yes |
Separate Service Layer | Yes | ? |
Web Flows | Yes | ? |
Community Driven | Good | Good |
WSDL | Yes | ? |
Reliability | Very Good | ? |
API | Good | Good |
Batch Processing | Yes | ? |
Cloud platform support | ˇ Amazon EC2 | ˇ Amazon EC2 |
ˇ Amazon S3 | ||
ˇ digital ocean | ||
ˇ ucloud biz | ||
ˇ OpenShift | ||
ˇ Windows Azure | ||
ˇ Google App Engine | ||
Admin Generator | Yes | ? |
Query Cache | Yes | ? |
Realtime | Yes | ? |
Data Security | Yes | ? |
Malicious Injection Prevention | Yes | Yes |
Perfomance | Very Good | Very Good |
Database migrations | Yes | Yes |
Debug Mode | Yes | Yes |
Unit Testing | Yes | Yes |
Ajax | Yes | Yes |
Extensions | 1500+ | ? |
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.
1 comment
Admin Generator = scaffolding ? If so – definitely YES, Query Cache – yes