PHP MVC Frameworks

Post Archives
Archive for the ‘PHP MVC Frameworks’ Category

Yii 1.1 Application Development Cookbook Book Review

September 14th, 2011 1 comment

Yii 1.1 Application Development Cookbook Book Review
It seems like a few other people looking for information on Yii Framework, the folks at Packt Publishing have also stumbled across my blog and thought it was worth reading… As a result they have asked me to review their new book by Alexander Makarov called Yii 1.1 Application Development Cookbook. I only got the book today, so havn’t yet even had a chance to open it, but I already think it’s a great thing that the folks at Packt Publishing recognise the potential of Yii Framework and it’s quickly growing community and the need for good quality documentation and learning material. After all, as nice as the online cookbook is and as good as all the tutorials are, I personally usually prefer to pick-up a hardcopy (or softcopy) and go through the new topic in a more structured way with someone who has experience on the particular topic guiding me through.

My experience with the last Yii Framework book by Packt wasn’t that great as I found that it focused too much on methodology of agile programmign with too much focus on testing instead of a more in-depth discussion of Yii Framework features, but this book looks a lot more promising. Also, I’ve asked Packt Publishing to send me the equivalent books on Zend and CodeIgniter so that in the spirit of comparison (which is what folk are usually looking for) I can not just review the book but also compare the books side-by-side to pass some judgement on the quality of the latest books available for each of these frameworks (with which I’m quite familiar without the need for the books already). One initial observation already is that the Codeigniter book is a bit outdated as CI has moved on to release 2.0 now with quite a few changes including ditching PHP4 support.

Anyways, stay tuned for the full book review, which will appear on this same URL, so feel free to link to it, so that by the time the review is up, folks will be able to easily find it.

Also, you can Buy Yii 1.1 Application Development Cookbook Book by following the link to the Packt Publishing website and if you’d like a sneak peak here’s free chapter on Extending Yii Framework

Share
Categories: PHP MVC Frameworks Tags:

Yii vs Zend vs Code Igniter Comparision

January 6th, 2011 97 comments

Choosing a PHP framework is not an easy task, especially if you have relatively little experience in PHP to know what makes a good framework or and what doesn’t, but choosing the right PHP framework for the job is absolutely critical in the long term as choosing the wrong PHP framework can lead to a number of negatives, such as longer development time, need for more experienced staff who may be hard to find and of course performance problems.  Unluckily (or perhaps luckily) when it comes to PHP there is such a plethora of PHP MVC Frameworks that it’s damn hard to actually boil them down to the final choice.  With ASP.NET for example it’s quite easy (although it’s gotten a little more complicated lately), previously there was only ASP.NET but now there’s also ASP.NET MVC, which is very different development paradigm and has it’s own catches.  However, one thing with .NET is that you need to choose how you’re going to do your data access, etc, but with most PHP Frameworks there is usually only one or two ways and they tend to do the job quite well.  So, now with this brief introduction, here’s the thoughts on Yii Framework (1.1.5) vs Zend Framework (1.11.0) vs Code Igniter (1.7.2).

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Yii DAO vs Active Record Performance

May 29th, 2010 10 comments

I’m writing a new app using Yii Framework, but one of my concerns with Yii has been the impact of using ActiveRecord and ORM on the application performance, so I decided to actually compare how the two perform and the results are quite interesting…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Codeigniter Template Layouts

May 28th, 2010 6 comments

All I have to say is WOW… I decided to give CodeIgniter a try as it’s a pretty light weight library and doesn’t try to force you into using ActiveRecord, but guess what?  There isn’t a built-in template layout concept so you can add a consistent header and footer and that’s like the most common thing anyone will do with a website.

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Writing a Fast PHP MVC Framework – Part 1

May 26th, 2010 8 comments

Well, after tossing and turning and considering using Yii and CodeIgniter, I’ve decided to bite the bullet and write my own fast PHP MVC Framework, that’s not bloated with features or compatibility layers I don’t want and takes advantage of PHP5.  Why re-invent the wheel you ask?  Because in my view what’s current out there is bloated and not quite what I want and most importantly ultimately impacts performance, which I very much about.  This framework that I’m writing is going to focus on speed and keeping ways to do something to an absolute minimum and do only what’s required.  For example, Yii is hell-bent on using ActiveRecord for everything and if you look at the code for active record with it’s built in ORM it’s like 2000 lines of code to generate SQL that you can write yourself just as easily.  With or without opcode caching lots and lots of code, lots and lots of files and all the un-necessary logic is still going to slow things down.  In CI’s care it’s nice and all, but it doesn’t play nicely with PHP IDEs atm so you better know the classes and methods pretty well.  Also, I can’t say I see the reason for doing things like defining file extentions (i.e. .php) as a constant, implementing fancy stuff like :any in the router and so on… just un-necessary logic… but as I said the biggest issue is not playing nice with PHP IDEs like NetBeans and Eclipse PDT.  The closest thing I’ve found to what I like has been what Daniel’s implemented in OpenCart which is somewhat based on PHP Pro MVC tutorial.  So to get started…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

ORM vs Code Generation

April 25th, 2010 4 comments

It seems no matter where you look these days everyone is using ORMs.  Every PHP Framework you look at has an ORM and it seems the preferred way to access data and .NET also now has LinqToSql and LinqToEntities which are both just ORMs.

I look at all these ORMs and read about problems with them where they don’t generate some SQL correctly, require you to learn a new language that tries to wrap SQL but doesn’t have the same power and it really makes me sad.  People have just no idea… They are prepared to trade off control and performance for some new concept that doesn’t really add anything good.  The productivity isn’t really increased all that much and you don’t really cut down on code all that much either if you are using code generation.

Now, code generation on the other is sooo much better and I’m really surprised that it hasn’t made it into all the frameworks and environments.  Code generation takes the mundane work out of initially creating lots and lots of similar code for the likes of CRUD operations but then you can quite easily modify it as needed.  Also people have built great big libraries like NetTiers that are based on code generation, but ultimately even those aren’t really needed.  The beauty of code generation is that you can generate really lean code and hence don’t really need all the compexity.

Ultimately I think serious developers will end up going back to good old SQL and code generation after this latest ORM fad is over.  If you want to write less code then just use a code generator, not some black box that does takes up CPU cycles and spits out SQL that isn’t guaranteed to be right.

Share
Categories: PHP MVC Frameworks Tags:

Choosing the Best PHP MVC Framework – Part 2

April 25th, 2010 4 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.

Share
Categories: PHP MVC Frameworks Tags:

PHP MVC Framework Performance – Part 1

April 8th, 2010 41 comments

As part of my assessment of PHP MVC Frameworks which I blogged about in Choosing the best PHP MVC Framework I decided to do a compare performance of the various PHP MVC Frameworks I was considering.  I did this using Apache Bench with ab -t 30 -c 10 http://testserver/framework/index.php as this is common and did the basic Hello World test where each framework just put out Hello World in an empty HTML document.  Here are the results…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Why Yii Framework is better than Kohana PHP

April 7th, 2010 49 comments

Recently I’ve set out comparing and choosing the best PHP MVC Frameworks so that I could then decide if I’m going to use an existing framework or roll my own minified super-efficient framework, because most frameworks seem too bloated for my liking these days (and hence run poorly on shared hosting).  Two of the frameworks I short-listed were Yii Framework and Kohana PHP.  After spending considerable time playing around with both I’ve come to the conclusion that Yii Framework is better than Kohana PHP. Here’s why…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Choosing the best PHP MVC Framework – Part 1

April 6th, 2010 18 comments

So, perhaps like me you are writing a fair bit of PHP and building some serious PHP apps.  Perhaps like me you have also decided that re-inventing the wheel for every app you write doesn’t make much sense and PHP by itself isn’t quite at a high enough level to be considered a framework.  I mean PHP is nice and all and there are fast ways to do many things in PHP, but there are far too many ways to do things in PHP and all you need is just one that works.  So having come to this realisation you decide that what you need is a PHP MVC Framework.   Read more…

Share
Categories: PHP MVC Frameworks Tags: