PHP controller for serving JSON requests enforcing REST arhitecture