I don't know of any existing projects, but there's a wealth of python code in calibre for converting various formats to mobi. I'd look into installing the python extension for php so you could import existing python objects and manipulate them with php... just so you don't have to completely re-invent the wheel. There's also the MobiPerl scripts.
Of course if re-inventing the wheel is what you have in mind.... have at it.