Home » PHP » PHP MVC Frameworks » Choosing the Best PHP MVC Framework – Part 2

Choosing the Best PHP MVC Framework – Part 2

April 25th, 2010 Leave a comment Go to comments

In Choosing the Best PHP MVC Framework – Part 1 I discussed what I feel is necessary of a good PHP MVC Framework.  So, I’ve spent a fair bit of time researching the various PHP MVC Frameworks and basically come the realisation that most of them aren’t all that great for one reason or another.  For one, many clearly didn’t keep in mind the use of a PHP IDE like NetBeans or Eclipse PDT and hence their design resulted in poor (if any) support for intelli-sense.  Because of this I’ve pretty much straight away discounted these frameworks as having to remember all the methods of an object and not have code completion is a real pain and really hurts productivity.  Of the two more or less popular frameworks left were Zend Framework and Yii Framework.  I found Zend Framework to be too general and as a result too heavy and slow… Zend Framework is really an enterprise framework that tries to be all things for all people and that’s nice, BUT you pay for it with performance and you can pretty much forget about using it without having at least a Virtual Private Server (or preferably a Dedicated Server) and OpCode Caching enabled.  Even with OpCode Caching it’s still not the best performer.  Yii Framework is a lot better from this perspective and feels a lot more natural and close to ASP.NET to which I’m quite used to as well.  What I really dislike about Yii is the fact that it is really built with ActiveRecord in mind.  Sure, you don’t have to use it, but then you loose many of the benefits that it offers.  For example if you store language dependent data in a separate table then Active Record becomes a bit more of a pain.  It is also a pain when you tend to aggregate a lot of data and in that case the whole Domain Model pattern doesn’t work all that great either and Table Module is far more practical.  Having spent a lot of time implementing web applications and other database driven apps in .NET and PHP I have found more and more that Domain Model is really not the best option and a real skill is knowing how to build an app that’s easy to develop and extend.  The use of ORM in pretty much all the frameworks is also something I don’t think of very highly, as they’re ultimately trading off performance and flexibility for bugs and pretty much having to learn another language.  I really think that for heavily database driven applications the best option is NOT to use a pattern such as Active Record and to keep the data separate from the business logic that acts on it.  PHP is particularly well suited to it with it’s use of associative arrays (although you do loose code completion support for fields as you would with untyped datasets in .NET, but that’s something most PHP developers are used to anyway).  Furthermore, I tend to use only MySQL, so I don’t really see much point of having a database abstraction layer.

So, rather than using an existing PHP MVC Framework which pretty much forces you into concepts I fundamentally disagree with or don’t need like ActiveRecord, ORM, Database Abstraction, etc. I’ve decided to write my own minimalistic framework that will be lean and mean, yet logical and with support for what I need rather than what someone may or may not need/want and stuff that kills perforamance and takes away control over SQL from me as the developer.

I will be posting about how I intend to design this framework as well, which is probably more for my own benefit as writing stuff down helps me think it through.

Categories: PHP MVC Frameworks Tags:
  1. dave
    May 9th, 2010 at 23:39 | #1

    for manage datas I think you should see Doctrine. it’s very powerful and can be use independant or in its framework symfony

    I think it could be powerful it used with a light framework like YII if possible (like you said when you have a little provider you can’t have a big framework ! ^^)

  2. May 9th, 2010 at 23:52 | #2

    When I looked at Symphony I found it to be very very heavy and hence have rather poor performance! I’d really prefer to have a comprehensive framework that does all these things rather than pick and choose bits from here and there.

  3. September 22nd, 2011 at 18:01 | #3

    I used ASP.NET C# , Symfony 1 + Doctrine, Codeigniter and Kohana before. First: Symfony 2 is not clear for me. I still looking it. Now I playing with Yii. My first impression is very well about Yii. it’s fast and easy. Orm features is good. Doctrine too complex and definitions more than Yii ORM. You can be use Yii for small or bigger projects. Thats enough for me.

  4. April 17th, 2012 at 05:51 | #4

    Over time, many things have also changed at the server end, commoditizing layers of work there. The same happens at the App dev level. And I see this going towards what really matters at the end of the day – user experience. Speed matters.

    AWS is 3 or more times faster than GoDaddy’s 4GH for example. And the cost difference doesn’t pull the wheels off the car, so it is worth it if your app is anything worthwhile. And Yii is blazing fast with APC on nginx, php-fpm consuming 2 to 5MB per page load vs Drupal’s 50+ MB which is ridiculous. You could probably beat that with your lean and mean framework. F3 being very lean beats Yii on memory consumption and would be very ideal for minimalistic-driven apps.

    And either Yii or F3 allows you to use your own ORMs or not. In some cases, I extend it with ezSQL for more complex queries. Well, any additional layers other than raw mySQL would cause performance degration logically. But unless you are optimizing for your next Facebookish app, the difference would be really minimal.

    And one of the main reason why we use a well-supported enough framework is for future maintenance, supposing you no longer code that much, but will be hiring coders to maintain and develop more stuff. I’m not so sure its a good idea to create your framework from scratch and document it for future maintenance.

  1. No trackbacks yet.

8 + = twelve