'fail', 'message' => $errorMsg, 'data' => $data ); $app = \Slim\Slim::getInstance(); $app->response()->setBody(json_encode($response)); $app->response()->finalize(); } public static function respondSuccess($data = null) { $response = array( 'status' => 'success', 'data' => $data ); $app = \Slim\Slim::getInstance(); $app->response()->setBody(json_encode($response)); $app->response()->finalize(); } }