Skip to content

feat: add StreamResponse and SSE response factories#10395

Open
michalsn wants to merge 11 commits into
codeigniter4:4.8from
michalsn:feat/stream-response
Open

feat: add StreamResponse and SSE response factories#10395
michalsn wants to merge 11 commits into
codeigniter4:4.8from
michalsn:feat/stream-response

Conversation

@michalsn

@michalsn michalsn commented Jul 8, 2026

Copy link
Copy Markdown
Member

Description
This PR adds first-class support for streaming HTTP responses. It introduces StreamResponse for responses generated progressively, such as large exports, proxied streams, or token-style output, and builds SSEResponse on top of it for Server-Sent Events. Streaming responses can be created from the response service with stream() and eventStream().

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added new feature PRs for new features 4.8 PRs that target the `4.8` branch. labels Jul 8, 2026

@memleakd memleakd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, looks useful! I left a few comments:

Comment thread system/HTTP/StreamResponse.php Outdated
Comment thread system/HTTP/StreamResponse.php Outdated
Comment thread user_guide_src/source/outgoing/response/041.php Outdated
Comment thread user_guide_src/source/outgoing/response/039.php Outdated

@memleakd memleakd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates. I left two small follow-up comments.

Comment thread system/HTTP/ResponseTrait.php Outdated
Comment thread user_guide_src/source/outgoing/response/040.php Outdated

@memleakd memleakd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick updates. Looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch. new feature PRs for new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants