MVC Frameworks


Finding the right MVC framework for web application development is very much a matter of personal choice. On moving from the .Net environment I first looked at Ruby on Rails, but later found that Groovy on Grails was a much better match with my way of doing things ...

But I have ended up going down a completely different track ...

Ruby on Rails vs Groovy and Grails

Ruby on Rails

Rails LogoRuby on Rails is now on version 3 and has a big following. In my opinion it is just trying to do too much.

Groovy and Grails

CSS Edit LogoI really like Groovy and Grails, but the cost of hosting excludes it for my smaller clients.

Horses for Courses

The choice of language and framework may well be dictated by your client or employer, but if you are an independent developer it is worth finding the framework that makes you most productive.

I have chosen another path - a path less trodden ...

PHP Frameworks

The heavy weights

I hadn't realised how many PHP frameworks there are out there. I spent a couple of weeks looking for a framework that suited me.

The most popular are Zend, CodeIgniter, Symfony, Yii, Kohana and Cakephp. My problem with these is that the are too heavyweight and with too steep a learning curve.

The light weights

So I started downloading and testing some of the lightweight frameworks such as Agile, Agile Tool Kit, FatFree, Faster, Hydrogen, LiteVC, MicroMVC, Shine, Simple, TinyMVC ...

The list goes on, and on. But all the frameworks I tried came with their own idiosyncrasies. So tried to sum up what it was I was looking for:

  • Minimalist MVC
  • Grails - like
  • PHP 5.3+
  • PDO

Another few google searches and I found phpAgile ...

phpAgile - the minimalist PHP framework

Virgin Territory

When I found phpAgile at the google code repository I think I was the first person to download the sample. Not a good sign, but this was about the first sample that worked, pretty much out of the box, and somehow ... it just felt right.

I think this is mainly down to the way it has been based on Grails. Nicolas Capeda, the author, is a Grails developer and has put together the most minimalist PHP framework to provide the routing and a simple ORM system.

Database Access

Unfortunately, the database handling didn't match my configuration, and I had already decided that PDO was the best way to go with PHP and MySQL (and most other) databases.

So I have re-written the database classes using PDO, and moved away from the ORM approach. As a long-in-the-tooth database developer I would rather specify how my objects map to the database. A simple set of PDO-based classes now manage database access and these are called from the Model layer where any specific application SQL is located.

And it just works. Simples!

Sample Application

I have now developed a sample application, which I will soon send to Nicolas Capeda, to see if he approves of my approach. If all goes well I hope that my changes to phpAgile will be the first formal release.

There will be more on this in forthcoming blogs.

<<  back