merged branch igorw/stream (PR #229)
Commits ------- 8dd779ec [stream] Fix rst formatting 73fe0b17 [stream] Add a nice API for streaming responses Discussion ---------- [stream] Add a nice API for streaming responses This PR adds a nice API for creating streaming responses with the new StreamedResponse class that was added to symfony [just recently](https://github.com/symfony/symfony/pull/2935). Usage is documented in the usage doc, but for lazy people: ```php <?php $app->get('/images/{file}', function ($file) use ($app) { if (!file_exists(__DIR__.'/images/'.$file)) { return $app->abort(404, 'The image was not found.'); } $stream = function () use ($file) { readfile($file); }; return $app->stream($stream, 200, array('Content-Type' => 'image/png')); }); ``` Note: I had to point the autoloader to a copy of symfony/symfony because the subtree splits are not up-to-date. Thus the vendors are out of date too right now.
Showing
Please register or sign in to comment