PHP CLASS for API