Overview
Each Slim application instance has one response object. The response object is an abstraction of your Slim application’sHTTP response that is returned to the HTTP client. Although each Slim application includes a default response object,the \Slim\Http\Response
class is idempotent; you may instantiate the class at will (in middleware or elsewhere inyour Slim application) without affecting the application as a whole. You can obtain a reference to the Slimapplication’s response object with:
<?php
$app = new \Slim\Slim();
$app->response;
An HTTP response has three primary properties:
- Status
- Header
- BodyThe response object provides helper methods, described next, that help you interact with these HTTP responseproperties. The default response object will return a 200 OK HTTP response with the text/html content type.