PHP code example of garlic / event-source
1. Go to this page and download the library: Download garlic/event-source library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
garlic / event-source example snippets
$server = new Hoa\Eventsource\Server();
while (true) {
// “tick” is the event name.
$server->tick->send(time());
sleep(1);
}