php api implementation