Best PHP DAL (data abstraction layer) so far

sakhunzai picture sakhunzai · Oct 18, 2011 · Viewed 33.9k times · Source

What is the best PHP DAL (data abstraction layer) so far developed under any open source project which we could re-use with good faith?

I am finding it hard to choose a DAL for my application that sufficiently supports abstraction to most common databases systems (MySQL, PostgreSQL, MSSQL, Oracle, etc) and is:

  1. widely tested,
  2. has good interface (readable method names, good parameter passing strategy),
  3. fast,
  4. lightweight,
  5. providing cache (e.g integrates with Memcache or supports a good caching mechanism),
  6. open-source license,
  7. should have adapters for at least MySQL/MySQLi (non-PDO based)

Some of the libararies to consider:

Please don't consider:

  • PDO
  • All ORMs (however, Doctrine seems to have a separate DAL besides ORM)

Answer

xmarcos picture xmarcos · Oct 22, 2011

If you can do with PHP 5.3, I would highly recommend Doctrine DAL, it's built on top of PDO, so you get the same performance plus a great API.

Update: If Doctrine is not good, you can try MDB2. It has drivers for most of the popular RDBMS, a robust API, great docs and a huge user base:

  • MySQL
  • MySQLi (PHP5 only)
  • PostgreSQL
  • Oracle
  • Frontbase
  • Interbase/Firebird (PHP5 only)
  • MSSQL
  • SQLite