PHP code example of takielias / laravel-sse-extended

1. Go to this page and download the library: Download takielias/laravel-sse-extended 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/ */

    

takielias / laravel-sse-extended example snippets


takielias\SSE\ServiceProvider::class,

'SSE' => takielias\SSE\Facades\SSEFacade::class,

@

/**
 * @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 takielias\SSE\Facades\SSEFacade;

public function myMethod()
{
    SSEFacade::notify('hello world....');
    
    // or via helper
    sse_notify('hi there');
}

SSEFacade::notify($message, $type = 'info', $event = 'message')

use takielias\SSE\Facades\SSEFacade;

public function myMethod()
{
    SSEFacade::notify('hello world....', 'info', 'UserLoggedIn');
    
    // or via helper
    sse_notify('hi there', 'info', 'UserLoggedIn');
}
bash
$ php artisan vendor:publish --provider="takielias\SSE\ServiceProvider"