Anche questa sembra fatta al caso tuo...
http://www.phpclasses.org/browse/package/3324.html