I’ve been building web apps for a long time now, I guess about 5 years. In the early days, database abstraction didn’t “exist”. Everyone just used the functions provided in the standard PHP library such as mysql_connect, mysql_query, etc. At some point, we as developers decided this wasn’t good enough. We needed an easier and a cleaner way to execute db calls.

Along comes PEAR and brings with it the DB package. DB promised to be an abstraction layer that provided an object oriented style API for querying most of the popular RDBMS. DB is now replaced by the MDB2 package, but the premise remains the same. I’ve never gotten on the PEAR bandwagon so I’ve always gone with writing my own implementations of some sort of simple abstraction layer.

I’ve gone through writing a set of simple functions all the way to implementing a full PHP5 MySQL class that I use for various web apps and I continue to change and modify the heck out of my abstraction layer. Where I am at now is a place of complete frustration. With all the time I’ve sunk into working and reworking my own abstraction layer, couldn’t I have just saved myself the trouble and hard-coded MySQL functions into my applications?

I mean, I can partially understand an Abs Layer for open source apps like SMF or phpBB since they aren’t in control of the RDBMS that the end user will be running, but for custom designed applications does it even make sense to go the route of abstraction?

At this point, I am beginning to think the answer to that is no. I’m curious to know what other developers think about this topic. I may ping some of the greater PHP minds out there and get some feedback.