# Response

New responses can be made throught the Wolff Response class.

Remember to use Core\Response.


Creating a new Response:

$response = new Response();

The header, remove, setCode and redirect methods can be used as chained methods. Making the process of creating a new Response easier and quicker.

$response->header('Content-Type', 'text/html; charset=utf-8')


Set HTTP code

Set the HTTP status code.


Get HTTP code

Returns the response HTTP status code.


Get redirect url

Returns the response url.


Add header

Add a new header to the response.

$response->header('Content-Type', 'text/html; charset=utf-8');

The first parameter is the header's key, the second is the header's value.

Get headers

Returns all the response headers (as an associative array).


Remove header

Remove a header if it exists.


The parameter must be the desired header's key to delete.

Redirect url

Set the Response's url.


The HTTP status code can be pass as an optional second parameter (this will overwrite the existing status code).

$response->redirect('https://getwolff.com', 200);


Execute the response with all of its values.