We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Bypass response buffering, stream live output

Hi guys,

New to phalcon, just testing the waters here.

One thing I can't figure out is how to do is stream live output (traceroute in this case to an ajax call).

For normal PHP, you'd call ob_start(); echo / print out the results in a loop, and call ob_flush()/flush() after each print job.

I couldn't find anything relevant within Phalcon\Http\Response() that would allow me to do anything similar.

What am I missing?

Thanks for taking the time to read this!



2.1k

dont think we have that feature. =d



843

Actually,

Doing the same thing here works. It looks odd and is a little unconventional, but it works.

$i = 0;
while ($i <= 9001)
{
    echo $i;
    ob_flush();
    $i++;
}

gives you streamed data, same as normal PHP.