Add Class-based PHP implementation and tests