Skip to content

Instantly share code, notes, and snippets.

@MattKetmo
Created May 20, 2012 17:57
Show Gist options
  • Save MattKetmo/2758928 to your computer and use it in GitHub Desktop.
Save MattKetmo/2758928 to your computer and use it in GitHub Desktop.
StreamedProcessResponse
<?php
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\Process\Process;
class StreamedProcessResponse extends StreamedResponse
{
public function __construct(Process $process, $status = 200, $headers = array())
{
$callback = function() use ($process) {
$process->run(function ($type, $buffer) {
echo $buffer;
flush();
});
};
parent::__construct($callback, $status, $headers);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment