What is the best ORM to use with codeigniter (php framework) and why? [closed] What is the best ORM to use with codeigniter (php framework) and why? [closed] codeigniter codeigniter

What is the best ORM to use with codeigniter (php framework) and why? [closed]


As DrColossos suggests, Doctrine is a good and powerful ORM which can be fairly easily plugged into a CI application.For CodeIgniter 2 & Doctrine 2, you can use this tutorial on Setting up CodeIgniter 2 with Doctrine 2 the Right Way.


The question is very vague and depends completely on the use case.

Anyway, I prefer Doctrine over the built-in database access simply because I preferr writing the queries instead of working with (IMO strange way of) CI's DB access. This has a much more OO feeling than the CI implementation and it is very powerfull since it allows you to do the same things as with regular SQL (complex joins, sub-selects, more advanced WHERE conditions).
I also prefer it since you can jump into the process of the querying meaning you can do actions before the query is commited, after it is commited, apply rules and much more. I haven't seen this in an easy way in CI.
Read the example in the docs to see what I'm talking about.

Integration into CI is painless with Doctrine (there are many posts available on the internet and even some here on SO) so you don't have to learn any fancy new conventions.

Whetever you chose, keep in mind that any ORM will add a massive (compared to what CI's base footprint is) overhead to a very very light-weight framework. So you sacrifice the light-weightness for powerfull database features and more abstraction.


I prefer to use Active Record. It's already there and I have not encountered a situation where it hasn't met my needs. I have not used another ORM on top of CodeIgniter, but I suspect it would add an unnecessary layer in most circumstances.

What do you need to do that the built in Active Record tools do not provide?