Skip to content

Commit 2b6eac2

Browse files
committed
[HttpFoundation] Add StreamedResponse string iterable documentation
1 parent b7f126c commit 2b6eac2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

components/http_foundation.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,19 @@ Streaming a Response
681681
~~~~~~~~~~~~~~~~~~~~
682682

683683
The :class:`Symfony\\Component\\HttpFoundation\\StreamedResponse` class allows
684-
you to stream the Response back to the client. The response content is
685-
represented by a PHP callable instead of a string::
684+
you to stream the Response back to the client. The response content can be
685+
represented by a string iterable::
686+
687+
use Symfony\Component\HttpFoundation\StreamedResponse;
688+
689+
$chunks = ['Hello', ' World'];
690+
691+
$response = new StreamedResponse();
692+
$response->setChunks($chunks);
693+
$response->send();
694+
695+
For most complex use cases, the response content can be instead represented by
696+
a PHP callable::
686697

687698
use Symfony\Component\HttpFoundation\StreamedResponse;
688699

0 commit comments

Comments
 (0)