{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/70","labels_url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/70/comments","events_url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/70/events","html_url":"https://github.com/zendframework/zend-diactoros/issues/70","id":96771347,"number":70,"title":"Stream as callback","user":{"login":"oscarotero","id":377873,"avatar_url":"https://avatars.githubusercontent.com/u/377873?v=3","gravatar_id":"","url":"https://api.github.com/users/oscarotero","html_url":"https://github.com/oscarotero","followers_url":"https://api.github.com/users/oscarotero/followers","following_url":"https://api.github.com/users/oscarotero/following{/other_user}","gists_url":"https://api.github.com/users/oscarotero/gists{/gist_id}","starred_url":"https://api.github.com/users/oscarotero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oscarotero/subscriptions","organizations_url":"https://api.github.com/users/oscarotero/orgs","repos_url":"https://api.github.com/users/oscarotero/repos","events_url":"https://api.github.com/users/oscarotero/events{/privacy}","received_events_url":"https://api.github.com/users/oscarotero/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zendframework/zend-diactoros/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-23T09:33:22Z","updated_at":"2015-07-23T19:54:42Z","closed_at":"2015-07-23T19:54:42Z","body":"Hi.\r\nI have an application that does some heavy work and I'd like to send to the client a stream with the output of the process. I mean something like this:\r\n\r\n```php\r\nuse Symfony\\Component\\Process\\Process;\r\n\r\nfunction handler ($request, $response) {\r\n    $process = new Process($command);\r\n\r\n    $stream = new StreamCallback(function () use ($process) {\r\n        $process->run(function ($type, $buffer) {\r\n            echo $buffer;\r\n            flush();\r\n        });\r\n    });\r\n\r\n    return $response->withBody($stream);\r\n);\r\n```\r\n\r\nIs there any way to do something like this?"},"comment":{"url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/comments/124223291","html_url":"https://github.com/zendframework/zend-diactoros/issues/70#issuecomment-124223291","issue_url":"https://api.github.com/repos/zendframework/zend-diactoros/issues/70","id":124223291,"user":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"created_at":"2015-07-23T19:54:42Z","updated_at":"2015-07-23T19:54:42Z","body":"We currently only have a single `StreamInterface` implementation, `Zend\\Diactoros\\Stream`. I'm interested in having additional implementations, and am open to pull requests to implement them.\r\n\r\nI did some prototypes in response to questions while we were developing PSR-7, however, and they might interest you:\r\n\r\n- https://gist.github.com/weierophinney/7c450a4ab3080c6a0413\r\n\r\n"}}