Refactor architecture of code base to include php backend