1. Go to this page and download the library: Download dweik/laravel-redis-stream 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/ */
'trim' => [
'channel-name' => 1000, // it means keep 1000 messages at most
],
use LaravelStream\Redis\Facades\Stream;
class SomeClass {
public function(){
/*
.
. some code
.
*/
/**
*
* @var string $channel channel name
* @var mixed $data the message data
* @var integer $trim (default null) the channel messages size,
* when using (null) value, this package will use
* the defined value on the config file "config/streaming.php".
* when using (zero) value that means stop trimming function
*/
$messageID = Stream::stream( $channel, $data, $trim);
}
}