yoink@tumblr ~ % date

26th October 2005

yoink@tumblr ~ % less 1130299200.txt

Bringing Some Order to PHP Web Apps

I’m trying to clean up my PHP by ripping off some stuff from rails (er, what little I’ve seen of it). There are some good frameworks that already do this for you, like PHP Biscuit, but, as always, the server that I’m working on doesn’t quite fit the bill when fulfilling the version requirements of newer frameworks. So.. yeah. One way to do it is to mush together a bunch of stuff that’s already out there. First off, I’d like to start with the model. Specifically, abstracting away the db and doing some object relational mapping. Tedious stuff that’s a bore to write… but a snap to generate. Here’s how with DB_DataObject:

  1. Install PEAR

    lynx -source http://go-pear.org/ | php

  2. Install DB_DataObject

    pear install ;

  3. Create your database
  4. Create an .ini file

    [DB_DataObject] database=mysql://name:pass.@localhost/dbname schema_location=/where_schema_will_be_stored class_location=/where_the_classes_are_generated require_prefix=/where_your_classes_are

  5. Generate code php /path_to_pear/DB/DataObject/createTables.php ~/brackets.ini

yoink@tumblr ~ % notes -v $post