Zero-Configuration ORM Library
Posted: Tue Apr 21, 2009 11:20 pm
* Moved to Code Critique as this is a functioning library presented for review *
Hey guys, first of all, I know I'm a noob so pardon me if this is in the wrong place or what-not.
The short story
I've released an early alpha version of a php/mysql ORM library. It supports what you'd expect, tables as objects with basic CRUD functionality, it respects relations, etc. It also has a pretty advanced query building interface that works hand in hand with the table objects. The coolest part is there is no configuration outside of providing mysql connection information. Samples and download are here: http://lilmikey.com/?page_id=274.
The long story
My contracts expired and I needed a project. I really liked the ease of use SubSonic for .NET offered and wanted something like that for php. The ORMs I toyed with in php required a bit of setup and a lot of source. All I wanted was a quick, easy library that I could drop in to any project without jumping through hoops. So I wrote it in SubSonic's image.
The library uses MySQL DDL queries to load schema information at run time. It only loads the schema as its requested and its cached for future use. That schema information drives generic row classes that provide the CRUD functionality. Getters, setters, and relations are handled through the blind function __call with validation against the schema. You get the validation and features of most common ORMs with none of the setup and configuration. Object instantiation is handled through a factory class that supports multiple named library instances (although that's far from adequately tested).
I've run it through the wringer using a number of test cases and the sample script included in the library hits most of the common bases. This is still very very early software and a lot needs to be done: sql parameterization and safety, better error reporting and handling, binary fields, just to name a few.
If there is interest in this project I'd be happy to continue working on it (however I hopefully have new paying work coming in soon) and if others want to spend time on it I can move it over to sourceforge.
Until then, it lives over here: http://lilmikey.com/?page_id=274
Thanks for your time and all feedback is appreciated.
Mike
Hey guys, first of all, I know I'm a noob so pardon me if this is in the wrong place or what-not.
The short story
I've released an early alpha version of a php/mysql ORM library. It supports what you'd expect, tables as objects with basic CRUD functionality, it respects relations, etc. It also has a pretty advanced query building interface that works hand in hand with the table objects. The coolest part is there is no configuration outside of providing mysql connection information. Samples and download are here: http://lilmikey.com/?page_id=274.
The long story
My contracts expired and I needed a project. I really liked the ease of use SubSonic for .NET offered and wanted something like that for php. The ORMs I toyed with in php required a bit of setup and a lot of source. All I wanted was a quick, easy library that I could drop in to any project without jumping through hoops. So I wrote it in SubSonic's image.
The library uses MySQL DDL queries to load schema information at run time. It only loads the schema as its requested and its cached for future use. That schema information drives generic row classes that provide the CRUD functionality. Getters, setters, and relations are handled through the blind function __call with validation against the schema. You get the validation and features of most common ORMs with none of the setup and configuration. Object instantiation is handled through a factory class that supports multiple named library instances (although that's far from adequately tested).
I've run it through the wringer using a number of test cases and the sample script included in the library hits most of the common bases. This is still very very early software and a lot needs to be done: sql parameterization and safety, better error reporting and handling, binary fields, just to name a few.
If there is interest in this project I'd be happy to continue working on it (however I hopefully have new paying work coming in soon) and if others want to spend time on it I can move it over to sourceforge.
Until then, it lives over here: http://lilmikey.com/?page_id=274
Thanks for your time and all feedback is appreciated.
Mike