views:

174

answers:

2

What DB extension PHP has (mysqli, PDO etc) is the best for enterprise level application? The important features that comes to my mind are:

  1. under active maintenance
  2. A lot of documentation and examples.
  3. Probably endorsed by the Mysql people themselves.
  4. Robust
  5. scalable
A: 

Real enterprise applications require not only a database extension, but ORM. I've heard sth about Doctrine, but can't tell you if it's stable, because I haven't used it.

I've looked at the features that it offers and it seems that this project is there for a while, because it has support for lazy loading, many-to-many relationships, inheritance, which are features that most of new ORMs don't have.

kubal5003
Um... no. ORM is not a must. It's simply one way to solve the problem. In fact the biggest problem with ORMs is they simply don't scale as well as partitioned SQL schemes do.
cletus
doctrine is pretty stable these days - I've not used the new shiney 1.2 version, which looks like it has a load of neat new stuff, but 1.0 is solid.
benlumley
There is nothing on this planet that *requires* an ORM. It's just one way of handling accesses to the database that many people happen to like. I'm one of the folks who don't.
Jan Krüger
@cletus surely therefore we need an orm that lets you use a partitioned schema?
benlumley
@cletus, @benlumley: IMHO, an ORM is about having a simpler (for some definition of that) interface to your data. The common tradeoff between simplicity and room for optimization applies. You can add all those optimization possibilities to your ORM, but at some point it stops having any advantage over straight SQL.
Jan Krüger
"There is nothing on this planet that requires an ORM."Of course. There is also nothing on the planet that requires a framework and there is nothing on the planet that requires OOP so why not use plain old C to create websites?
kubal5003
Because ORM can be a pain in the bum as soon as you do something more complex than a simple `SELECT`. I personally find the whole idea of ORMs extremely limiting.
Andrew Moore
+1  A: 

1. under active maintenance

mysqli and PDO. if you end up using a framework, it will probably be using mysqli anyway.

2. A lot of documentation and examples.

mysqli and PDO.

3. Probably endorsed by the Mysql people themselves.

mysqli. see http://dev.mysql.com/doc/refman/5.0/en/apis-php.html

4. Robust

if i had to point to 1 single PHP extension that answers the question "which one is used most often and has the most number of people scrutinizing it for bugs?", i would have to vote for mysqli. if you have a different definition of robust, you'll have to elaborate.

5. scalable

it depends what you mean by scalable. in the mysqli vs. PDO shootout, mysqli has the tightest codebase and is therefore more scalable simply because the code is lighter. YMMV. IANAL.

but if you want something that helps you to scale (such as distributing load across a couple of mysql servers) you'll need something to wrap mysqli/PDO because nothing at the mysqli/PDO/whatever level will do this for you.

longneck