Skip to content

Conversation

mtarld
Copy link
Contributor

@mtarld mtarld commented Dec 10, 2024

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

Improve DX by supporting iterable of string in StreamedResponse so that it's more convenient streaming a list of strings.

Before:

$iterable = ['foo, 'bar', 'baz'];
$response = new StreamedResponse(function () use ($iterable): void {
    foreach ($iterable as $chunk) {
        echo $chunk;
    }
});

After:

$iterable = ['foo, 'bar', 'baz'];
$response = new StreamedResponse($iterable);

@mtarld mtarld force-pushed the feat/streamed-response-iterable branch from 36c8cb7 to 7e4178a Compare December 10, 2024 12:42
@fabpot
Copy link
Member

fabpot commented Dec 10, 2024

Thank you @mtarld.

@fabpot fabpot merged commit cfe09c2 into symfony:7.3 Dec 10, 2024
8 of 11 checks passed
@mtarld mtarld deleted the feat/streamed-response-iterable branch December 10, 2024 17:31
@fabpot fabpot mentioned this pull request May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants