HTTP response is represented by response service, which is available as a property in controllers. You can use this service, if you want to controll the way of response generation.
It's used like this:
public function someAction()
{
// .... do something here and finally
$this->response->redirect('http://example.com');
}
Now, let's take a look at available methods:
\Krystal\Http\Response\HttpResponse::download($file, $alias = null)
Send a file back to user for downloading. The first $file argument is a path to be file to be sent, and the second $alias is an optional alias name, which overrides a base name of selected file.
\Krystal\Http\Response\HttpResponse::setStatusCode($code)
Sets HTTP status code.
\Krystal\Http\Response\HttpResponse::redirect($url)
Redirects to another URL.
\Krystal\Http\Response\HttpResponse::enableCache($timestamp, $ttl)
Enables HTTP cache. The first $filestamp must be a timestamp of latest modification, and the second $ttl defines a lifetime in seconds.
Completely disables HTTP cache.
\Krystal\Http\Response\HttpResponse::setContentType($type, $charset)
Defines content type with its preferred charset.
\Krystal\Http\Response\HttpResponse::setSignature($signature)
Sets HTTP X-Powered-By signature.