• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Server-sent events in PHP (without echo or print)

phpmagentoserver-sent-events


PHP Snippet 1:

   /**
     * Send Data
     *
     * @param string $content
     */
    function sseEchoAlternative(string $content)
    {
        ob_start(function () use ($content) { //Expect a warning here
            return $content;
        });
        ob_end_flush();
    }

Related Snippets

If you intend you use SMTP, add your SMTP Code after this Line

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

XSS attack still works despite htmlspecialchars() doing its work

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Add 2 Webcam in one page with WebcamJS

Symfony Error: "An exception has been thrown during the rendering of a template"

Star rating with half star support

How to create a individual template for page or post in custom plugin?

Auto increment id JSON

Using array_intersect on a multi-dimensional array

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

Yii Ajax Submit button

Make certain characters of a word from string bold

Magento Installation SQLSTATE[HY000] [2002] No such file or directory error

Unable to guess the mime type as no guessers are available Laravel 5.2

About Contact Privacy policy Terms and conditions