ported to php

it has some examples inside the class