Response
in package
Represents the HTTP response
Table of Contents
- $headers : array<string|int, mixed>
- Stores the headers for the response
- clearHeaders() : void
- Clears the headers
- header() : string|null
- Returns with a header value by name
- send() : void
- Sends the headers then the given body content
- setHeader() : void
- Sets a header for the response
Properties
$headers
Stores the headers for the response
protected
array<string|int, mixed>
$headers
= []
Methods
clearHeaders()
Clears the headers
public
clearHeaders() : void
Return values
void —header()
Returns with a header value by name
public
header(string $name[, string|null $default = null ]) : string|null
Parameters
- $name : string
-
The header name
- $default : string|null = null
-
The default value if the header doesn't present
Return values
string|null —The header value or default
send()
Sends the headers then the given body content
public
send([string $content = '' ]) : void
Parameters
- $content : string = ''
-
The body content of the response
Return values
void —setHeader()
Sets a header for the response
public
setHeader(string $name, string $value) : void
Parameters
- $name : string
-
The name of the header
- $value : string
-
The value of the header