1. Go to this page and download the library: Download vluzrmos/lumen-socketio 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/ */
$app->get('/publish', function() {
publish('channel', 'awesome-event', 'An message');
publish('channel', 'awesome-event', ['message' => 'An message', 'user' => \App\User::first()]);
});
//or, in your controller or some else method (using Dependency Injection)
public function publishSomethingAwesome(\Vluzrmos\Socketio\Contracts\Broadcast $broadcast){
$broadcast->publish('channel', 'awesome-event', 'An message');
// or just use the helper without inject \Vluzrmos\Socketio\Contracts\Broadcast
publish('channel', 'awesome-event', 'An message');
}
bash
php artisan serve
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.