1. Go to this page and download the library: Download rockstarcode/streamline 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/ */
rockstarcode / streamline example snippets
// routes file
Route::get('/subscribe/{channel}',function($channel){
use RockstarCode\StreamLine\Subscribe;
$subscribe = new Subscribe($channel, function(){
/// optional custom connection
$client = new Redis();
$client->connect('127.0.0.1');
return $client;
});
$subscribe->stream(function($message){
/// function that handles each message as it's received in the channel
echo json_encode(['status'=>true,'message'=>$message]);
});
});
Route::post('/subscribe/{channel}',function($channel, Request $request){
use RockstarCode\StreamLine\Publish;
$pub = new Publish($channel);
$subscribe->send($request->only('message'));
});
./example
- .htaccess
- frontend.php
- index.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.