Replies: 2 comments 2 replies
-
Hi. What is the issue with the callback that is now implemented? |
Beta Was this translation helpful? Give feedback.
2 replies
-
@marius-mcp having a nice helper to passthrough a StreamInterface would be great since it is in PSR as well. We are using simillar macros accross our codebase as well, so it would be amazing if laravel could have this out of the box. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For Http or Guzzle responses that exceed the memory limit (or if calling
sendContent()
exceeds it due to copying the response$content
) you want to pass through the responses directly to the user but atm. you have to either save the response to a tmpfile or use the callback() function from Response::stream. In every one of my projects i have some internal files/apis that i need to directly pipe through and their responses exceed "normal memory limits".What i currently do with a macro:
I would like to add two more functions to
src/Illuminate/Routing/ResponseFactory.php
but i wouldn't add ainstanceof
check insidestream()
orstreamDownload()
. I'm also not sure how to name them. Feel free to suggest and if this is useful i can create a PR.I intentionally chose to loop over
$stream
instead of usingfpassthru
because that function has it's own problems and i haven't tested everyStreamInterface
implementation.Beta Was this translation helpful? Give feedback.
All reactions