PHP code example of sarfraznawaz2005 / laravel-sse
1. Go to this page and download the library: Download sarfraznawaz2005/laravel-sse 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 Sarfraznawaz2005\SSE\Facades\SSEFacade;
public function myMethod()
{
SSEFacade::notify('hello world....');
// or via helper
sse_notify('hi there');
}
use Sarfraznawaz2005\SSE\Facades\SSEFacade;
public function myMethod()
{
SSEFacade::notify('hello world....', 'info', 'UserLoggedIn');
// or via helper
sse_notify('hi there', 'info', 'UserLoggedIn');
}