Symfony\Component\HttpFoundation\StreamedResponse
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.
- Author: Fabien Potencier <fabien@symfony.com>
Synopsis
class StreamedResponse
extends Response
{
- // Inherited members from Response
- public ResponseHeaderBag $headers;
- protected string $content;
- protected string $version;
- protected integer $statusCode;
- protected string $statusText;
- protected string $charset;
- public array $statusTexts;
- // methods
- public void __construct()
- public static void create()
- public void setCallback()
- public void prepare()
- public void sendContent()
- public void setContent()
- public false getContent()
- // Inherited methods from Response
- public void __construct()
- public static Response create()
- public string __toString()
- public void __clone()
- public Response prepare()
- public Response sendHeaders()
- public Response sendContent()
- public Response send()
- public Response setContent()
- public string getContent()
- public Response setProtocolVersion()
- public string getProtocolVersion()
- public Response setStatusCode()
- public integer getStatusCode()
- public Response setCharset()
- public string getCharset()
- public Boolean isCacheable()
- public Boolean isFresh()
- public Boolean isValidateable()
- public Response setPrivate()
- public Response setPublic()
- public Boolean mustRevalidate()
- public DateTime getDate()
- public Response setDate()
- public integer getAge()
- public Response expire()
- public DateTime|null getExpires()
- public Response setExpires()
- public integer|null getMaxAge()
- public Response setMaxAge()
- public Response setSharedMaxAge()
- public integer|null getTtl()
- public Response setTtl()
- public Response setClientTtl()
- public DateTime|null getLastModified()
- public Response setLastModified()
- public string|null getEtag()
- public Response setEtag()
- public Response setCache()
- public Response setNotModified()
- public Boolean hasVary()
- public array getVary()
- public Response setVary()
- public Boolean isNotModified()
- public Boolean isInvalid()
- public Boolean isInformational()
- public Boolean isSuccessful()
- public Boolean isRedirection()
- public Boolean isClientError()
- public Boolean isServerError()
- public Boolean isOk()
- public Boolean isForbidden()
- public Boolean isNotFound()
- public Boolean isRedirect()
- public Boolean isEmpty()
- protected void ensureIEOverSSLCompatibility()
Hierarchy
Members
protected
- $callback
- $charset — string
- $content — string
- $statusCode — integer
- $statusText — string
- $streamed
- $version — string
public
- $headers — \Symfony\Component\HttpFoundation\ResponseHeaderBag
- $statusTexts
—
array
Status codes translation table.
Methods
public
- __construct() — Constructor.
- create() — {@inheritDoc}
- getContent() — {@inheritdoc}
- prepare() — {@inheritdoc}
- sendContent() — {@inheritdoc}
- setCallback() — Sets the PHP callback associated with this Response.
- setContent() — {@inheritdoc}
Inherited from Symfony\Component\HttpFoundation\Response
protected
- ensureIEOverSSLCompatibility() — Check if we need to remove Cache-Control for ssl encrypted downloads when using IE < 9
public
- __clone() — Clones the current Response instance.
- __toString() — Returns the Response as an HTTP string.
- create() — Factory method for chainability
- expire() — Marks the response stale by setting the Age header to be equal to the maximum age of the response.
- getAge() — Returns the age of the response.
- getCharset() — Retrieves the response charset.
- getContent() — Gets the current response content.
- getDate() — Returns the Date header as a DateTime instance.
- getEtag() — Returns the literal value of the ETag HTTP header.
- getExpires() — Returns the value of the Expires header as a DateTime instance.
- getLastModified() — Returns the Last-Modified HTTP header as a DateTime instance.
- getMaxAge() — Returns the number of seconds after the time specified in the response's Date header when the response should no longer be considered fresh.
- getProtocolVersion() — Gets the HTTP protocol version.
- getStatusCode() — Retrieves the status code for the current web response.
- getTtl() — Returns the response's time-to-live in seconds.
- getVary() — Returns an array of header names given in the Vary header.
- hasVary() — Returns true if the response includes a Vary header.
- isCacheable() — Returns true if the response is worth caching under any circumstance.
- isClientError() — Is there a client error?
- isEmpty() — Is the response empty?
- isForbidden() — Is the response forbidden?
- isFresh() — Returns true if the response is "fresh".
- isInformational() — Is response informative?
- isInvalid() — Is response invalid?
- isNotFound() — Is the response a not found error?
- isNotModified() — Determines if the Response validators (ETag, Last-Modified) match a conditional value specified in the Request.
- isOk() — Is the response OK?
- isRedirect() — Is the response a redirect of some form?
- isRedirection() — Is the response a redirect?
- isServerError() — Was there a server side error?
- isSuccessful() — Is response successful?
- isValidateable() — Returns true if the response includes headers that can be used to validate the response with the origin server using a conditional GET request.
- mustRevalidate() — Returns true if the response must be revalidated by caches.
- prepare() — Prepares the Response before it is sent to the client.
- send() — Sends HTTP headers and content.
- sendContent() — Sends content for the current web response.
- sendHeaders() — Sends HTTP headers.
- setCache() — Sets the response's cache headers (validation and/or expiration).
- setCharset() — Sets the response charset.
- setClientTtl() — Sets the response's time-to-live for private/client caches.
- setContent() — Sets the response content.
- setDate() — Sets the Date header.
- setEtag() — Sets the ETag value.
- setExpires() — Sets the Expires HTTP header with a DateTime instance.
- setLastModified() — Sets the Last-Modified HTTP header with a DateTime instance.
- setMaxAge() — Sets the number of seconds after which the response should no longer be considered fresh.
- setNotModified() — Modifies the response so that it conforms to the rules defined for a 304 status code.
- setPrivate() — Marks the response as "private".
- setProtocolVersion() — Sets the HTTP protocol version (1.0 or 1.1).
- setPublic() — Marks the response as "public".
- setStatusCode() — Sets the response status code.
- setTtl() — Sets the response's time-to-live for shared caches.
- setVary() — Sets the Vary header.