PHP code example of iankibet / redis-stream

1. Go to this page and download the library: Download iankibet/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/ */

    

iankibet / redis-stream example snippets


return [
    'group' => env('REDIS_STREAM_GROUP', env('APP_NAME', 'laravel')),

    'consumer' => env('REDIS_STREAM_CONSUMER', env('REDIS_STREAM_GROUP', env('APP_NAME', 'laravel'))),

    'handlers' => [
        'user_activity' => [
            App\Jobs\ProcessUserActivity::class,
        ],
        'order_events' => [
            App\Events\OrderCreated::class,
        ],
    ],
];

use Iankibet\RedisStream\RedisStream;

RedisStream::publish('order_events', [
    'order_id' => 123,
    'status' => 'created',
]);
bash
php artisan vendor:publish --tag=redis-stream
bash
php artisan redis:consume-stream
bash
php artisan redis:consume-stream worker-1
bash
php artisan test