This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Server sent events library.

dev-master 2017-05-24 19:04 UTC

This package is not auto-updated.

Last update: 2021-09-18 12:01:43 UTC


SSE is a Laravel wrapper for PHP Library LibSSE for implementing asynchronous Server Sent Events and pass them on to views.

Laravel Supported versions

Laravel: 5.1



Installing SSE

Use composer to download latest package to laravel installation

	composer require manfal/sse

or manually add package in require array of composer.json

    "manfal/sse": "dev-master"

and run

	composer update

place following service provider in config/app.php folder under providers array.


place following facades in config/app.php folder under aliases array.

	'SSE' => 'manfal\sse\SSEFacade',
	'SSEEvent' => 'manfal\sse\SSEEventFacade'


  1. Create a new view in resources/views directory, name it ssedemo.blade.php and place following HTML and JS snippet.
	<span id="time"></span>
	var source = new EventSource('{!!url("/ssedemo")!!}');
	var d = document.getElementById('time');
		var time =;
		d.innerHTML = time;
  1. Create a new controller via artisan CLI
$>	php artisan make:controller SSEDemoController
  1. Place following code in SSEDemoController
		namespace App\Http\Controllers;

		use Illuminate\Http\Request;

		use App\Http\Requests;
		use App\Http\Controllers\Controller;
		use SSEEvent;
		use SSE;

		class TimeEvent extends SSEEvent {
		    public function update(){
		        return date('l, F jS, Y, h:i:s A');

		class SSEDemoController extends Controller
		     * Display a listing of the resource.
		     * @return Response
		    public function index()
		        return view('ssedemo');

		    public function sseCheck() {
		            $sse = new SSE();
		            $sse->addEventListener('time',new TimeEvent());
  1. Create a new route in app/Http/routes.php
	Route::get('/ssedemo', 'SSEDemoController@sseCheck');
  1. Refresh your browser.