Fork of https://github.com/tonyhhyip/laravel-sse . Made for Laravel 8.
This library provides Server Sent Event for Laravel using libSSE-php
To install Laravel SSE as a Compsoer package to be used in Laravel 5, simply add this to your composer.json
:
"artel-studio/laravel-sse": "~1.0"
and run composer update
.
Once it is installed, you can register the SseServiceProvider
in app/config/app.php
in providers
array.
If you want, you can also add the alias SSE:
'providers' => [
...
Sse\Laravel\SseServiceProvider::class
],
'alias' => [
...
'SSE' => Sse\Laravel\Facade\SSE::class
]
You can inject the SSE in your controller
class HomeController extends Controller
{
public function sse(SSE $sse)
{
// Add your event listener
return $sse->createResponse();
}
}