File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -681,8 +681,19 @@ Streaming a Response
681
681
~~~~~~~~~~~~~~~~~~~~
682
682
683
683
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::
686
697
687
698
use Symfony\Component\HttpFoundation\StreamedResponse;
688
699
@@ -710,6 +721,10 @@ represented by a PHP callable instead of a string::
710
721
// disables FastCGI buffering in nginx only for this response
711
722
$response->headers->set('X-Accel-Buffering', 'no');
712
723
724
+ .. versionadded :: 7.3
725
+
726
+ Support for using string iterables was introduced in Symfony 7.3.
727
+
713
728
Streaming a JSON Response
714
729
~~~~~~~~~~~~~~~~~~~~~~~~~
715
730
You can’t perform that action at this time.
0 commit comments