Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class::DBI-like library for php?

Tags:

php

orm

perl

I have inherited an old crusty PHP application, and I'd like to refactor it into something a little nicer to deal with, but in a gradual manner. In perl's CPAN, there is a series of classes around Class::DBI that allow you to use database rows as the basis for objects in your code, with the library generating accessor methods etc as appropriate, but also allowing you to add additional methods.

Does anyone know of something like this for PHP? Especially something that doesn't require wholesale adoption of a "framework"... bonus points if it works in PHP4 too, but to be honest, I'd love to have another reason to ditch that. :-)

like image 294
AnotherHowie Avatar asked Aug 11 '08 22:08

AnotherHowie


1 Answers

It's now defunct but phpdbi is possibly worth a look. If you're willing to let go of some of your caveats (the framework one), I've found that Doctrine is a pretty neat way of accessing DBs in PHP. Worth investigating anyway.

like image 120
GaryF Avatar answered Sep 17 '22 15:09

GaryF