class Response extends Response

Methods

setBody(mixed $body)

Set the body content of the response.

static RedirectResponse
redirect(string $location, int $code = 302, array $headers = [])

Create a redirect response.

static Response|RedirectResponse
parse(mixed $response)

Parse a response object and return a formatted HTTP response.

Details

at line 11
setBody(mixed $body)

Set the body content of the response.

Parameters

mixed $body

The content to write to the response body.

at line 23
static RedirectResponse redirect(string $location, int $code = 302, array $headers = [])

Create a redirect response.

Parameters

string $location

The URL to redirect to.

int $code

The HTTP status code for the redirect (default: 302).

array $headers

Additional headers to include in the response.

Return Value

RedirectResponse

at line 39
static Response|RedirectResponse parse(mixed $response)

Parse a response object and return a formatted HTTP response.

Parameters

mixed $response

The response to parse. Can be of various types:

  • \Laminas\Diactoros\Response\RedirectResponse: Returns as-is.
  • \App\System\MVC\View\View: Builds the view content.
  • \App\System\MVC\Model: Converts the model to JSON.
  • \stdClass: Converts the object to an array.
  • bool: Converts to "1" or an empty string.
  • array or \Illuminate\Support\Collection: Encodes to JSON.

Return Value

Response|RedirectResponse