php port of the ruby middleware library