First try at PHP implementation of Peregrin