Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cakephp and Yii: similarities/differences/speed?

Tags:

cakephp

yii

I am a CakePhp programmer. I have decided to try out the Yii framework. I would like to find out in what ways is CakePhp is similar to and different from Yii. Also, is Yii measurably faster than CakePhp as they claim?

like image 967
aWebDeveloper Avatar asked Nov 29 '10 09:11

aWebDeveloper


People also ask

Why Yii is the best framework?

The Benefits of Yii2 Development Like Symphony and Laravel, Yii2 is an open-source framework for both back-end and front-end programming. A lot of explanatory documentation helps to sort out many issues and the framework is also supported by a community of significant size. Yii also supports Object-Relational Mapping.

What is Yii used for?

Yii is a high-performance, component-based PHP framework for developing large-scale Web applications rapidly. It enables maximum reusability in Web programming and can significantly accelerate your Web application development process. The name Yii (pronounced Yee or [ji:] ) is an acroynym for "Yes It Is!".

Is Yii Framework good?

Still, Symfony and Yii are both excellent frameworks.

Is Yii a framework?

Yes, it is! Yii is a fast, secure, and efficient PHP framework.


2 Answers

From personal experience, there's several difference in both frameworks, particularly the way models are handled in cake vs yii.

  • In cakephp you cannot use composite primary key, this is the main deal-breaker for me. Composite primary key is supported in Yii.
  • Cakephp enforces convention, while yii favors convention, you are not forced to follow a certain standard. While enforced convention is a good way to build good programming practice, in the end the flexibility that yii offered wins this round for me.
  • Out of the box performance, I think yii has the advantage, but as with performance tuning, with proper cache configuration, and as long as you are careful in using the ActiveRecord patterns, they are not that much apart

As a side note, I have lead web app implementation with both CakePHP and Yii, the feedback that I got from the team was that the less experienced team preferes CakePHP, while Yii is preferred by the more experienced team. Make of that what you will.

like image 180
ZaQ Avatar answered Sep 21 '22 04:09

ZaQ


An old post but just adding some experience to it.

I have been using cake for a while now. 3 years to be precise.

Presently Yii is definitely the one leading the MVC technology in PHP. It is a framework to which may be no other PHP framework can presently compare. Personally i was really impressed with the "grid"... i thought PHP side had always lacked this in some way :) It is amazingly fast and suits wide range of developers.

For CakePHP : I have read number of blogs where people claim and probably cling on to "conventions" and "strictness" of the framework.

That said, I would agree and disagree. The claims that are usually made kind of seem pretty obvious once you get hang of it. Every rule that cake quote Forces quote can easily be overridden. Most importantly what people fail to notice is why are the conventions forced ?

If you are a developer who has lots of production pressure i would say auto-magic of cake that runs behind the scene, like getting related models data, saving related models data, defining the relations based on conventions is absolutely amazing.

The neatness that comes from following those conventions can not be explained here but only experienced.

I have also read lots of blogs where I have seen complaints over the speed of the framework. In my experience I would say, you should read the book. People define number of relationships, Cake by default fetches all its related models data. You can override this behavior and just fetch the data that you need. In fact your bind, unbind your models on the fly. Cake also has a behavior called "containable" for the very purpose.

Once you get your hands set on cake, production and developments is truly truly "RAPID".

Also, lot has changed since CakPHP 2, it's very fast and even more scalable.

All said, I really believe Cake has very poor documentation; and with better documentation, more real world examples and repositories, it would be a stronger contender.

like image 40
Kishor Kundan Avatar answered Sep 23 '22 04:09

Kishor Kundan