I currently use Kohana as a PHP framework. I’d already lost faith to PHP framework so I built my applications straightly from Drupal. But after starting my new (current) job, we need to use a framework. The current framework used at that time was Code Igniter, which was embedded inside Drupal so we don’t have to deal with any authentication and acl issues and have a CMS out of the box. I’m not a fan of CodeIgniter. You know what, it suggest people to write HTML form by hand, one by one and it validation library is the fugliest I’ve ever seen in my life. You define the rules inside an array and if you want friendly error message for that validation, you have to define another array repeating yourself again. Wtf ! The way the validation library was designed make it really hard to create a wrapper that would automate all the tedious tasks. We try our best and we have a wrapper that would automate form generation from a schema file and automatically handle the validation part but it’s not fun with ugly hack here and there which is really hard to maintain and add new features. Every time user comes with a feature request, oh damn I have to hack it again.

Then we found Kohana. It look’s better but I made my biggest mistake in my life. Without doing any proper testing for PostgreSQL support, we start porting our apps to Kohana and the nightmare started. First we found out PostgreSQL support was next to none. Yes the code is there but almost nobody test the code. Their ORM failed to work with our database because we used schema and the devs don’t even have any clue what is schema ! It also failed to work because they assumed all table should have ‘id’ column and foreign key should be named ‘reftable_id’ which is completely nonsense, “convention over configuration” wtf. I try to fix that but then realized it almost rewriting the whole stuff my self.

Kohana validation library is good. Much better than CodeIgniter until I found out they stripped out the code to display generic error messages and require you to specify error message for every fields and every rules that you have. That means n fields x n rules for every elements that you need to validate. Again, wtf ! Fixing that almost impossible because it was designed to prevent you providing generic error messages. I’m still OK with this because I still have some idea on how to fix it.

The sad state is on ORM part. There’s almost none in PHP world. Some people would suggest Doctrine or Propel but anything that generate code is out of my consideration. Actually I like Kohana’s ORM. It’s light and it does not support PostgreSQL (properly). Currently we used IgnitedRecord which we brought from CodeIgniter but I think our life would be much better without it. The relationship work though with a very weird syntax but the dev think the relation only exist when you already have records inside db so something like:-

$customer = new Customer_Model; $customer->order->qty = 2; $customer->save();

would be impossible and you have to do it manually. So what’s the point of using ORM ? With few lines of code, I can do the same things without the overhead of ORM. That’s why I think our life would be much better without it. Writing ORM is not an easy task and that’s why I want to stay away from it. I would stay away from any framework that it developer think writing ORM is easy.

We still need PHP, at least for this project and Kohana is enough for us. I don’t want to waste my time hunting for PHP framework anymore. If we really need better framework in the future, it definitely in the Python world. I just need some good enough ORM or not using it at all.

Amran (not verified) on Sun, 12/28/2008 - 23:17

Mmg susah cari frameworksaya rasa yg baik. Walaupun x suka apa2 framework yg generate code. Saya rasa cakephp 1.2 dah cater problem di atas. Validation with generic msg, pgsql support, orm yg ok dgn semua primary n foreign key boleh di ubah. Validation masih guna array yg pening ,tp apa php tanpa array;). Nice to c ur blog using drupal ,mmg advocate drupal 4 cms juga.