1. Go to this page and download the library: Download khairy/laravel-sse-stream 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/ */
/**
* @param string $message : notification message
* @param string $type : alert, success, error, warning, info
* @param string $event : Type of event such as "EmailSent", "UserLoggedIn", etc
*/
SSEFacade::notify($message, $type = 'info', $event = 'message')
use Khairy\LaravelSSEStream\Facades\SSEFacade;
public function myMethod()
{
SSEFacade::notify('hello world....');
// or via helper
sse_notify('hi there');
}
use Khairy\LaravelSSEStream\Facades\SSEFacade;
public function myMethod()
{
SSEFacade::notify('hello world....', 'notification', 'login');
// or via helper
sse_notify('hi there', 'notification', 'login');
}