class StreamedResponse extends Response
StreamedResponse represents a streamed HTTP response.
A StreamedResponse uses a callback for its content.
The callback should use the standard PHP functions like echo
to stream the response back to the client. The flush() method
can also be used if needed.
Methods
|
__construct(mixed $callback = null, integer $status = 200, array $headers = array())
Constructor. |
||
| static Response |
create($callback = null, integer $status = 200, array $headers = array())
Factory method for chainability |
|
|
setCallback(mixed $callback)
Sets the PHP callback associated with this Response. |
||
| Response |
prepare(Request $request)
Prepares the Response before it is sent to the client. |
|
| Response |
sendContent()
Sends content for the current web response. |
|
| Response |
setContent(mixed $content)
Sets the response content. |
|
| false |
getContent()
Gets the current response content. |
Details
at line 43
public
__construct(mixed $callback = null, integer $status = 200, array $headers = array())
Constructor.
at line 56
static public Response
create($callback = null, integer $status = 200, array $headers = array())
Factory method for chainability
Example:
return Response::create($body, 200)
->setSharedMaxAge(300);
at line 68
public
setCallback(mixed $callback)
Sets the PHP callback associated with this Response.
at line 79
public Response
prepare(Request $request)
Prepares the Response before it is sent to the client.
This method tweaks the Response to ensure that it is
compliant with RFC 2616. Most of the changes are based on
the Request that is "associated" with this Response.
at line 91
public Response
sendContent()
Sends content for the current web response.
at line 111
public Response
setContent(mixed $content)
Sets the response content.
Valid types are strings, numbers, and objects that implement a __toString() method.
at line 123
public false
getContent()
Gets the current response content.