PHP code example of chelout / laravel-yandex-message-queue

1. Go to this page and download the library: Download chelout/laravel-yandex-message-queue 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/ */

    

chelout / laravel-yandex-message-queue example snippets




return [
    // ...

    'connections' => [
        // ...

        'ymq' => [
            'driver'    => 'ymq',
            'key'       => env('YANDEX_MESSAGE_QUEUE_KEY'),
            'secret'    => env('YANDEX_MESSAGE_QUEUE_SECRET'),
            'prefix'    => env('YANDEX_MESSAGE_QUEUE_PREFIX', 'https://message-queue.api.cloud.yandex.net/your-account-id'),
            'queue'     => env('YANDEX_MESSAGE_QUEUE_QUEUE', 'default'),
            'suffix'    => env('YANDEX_MESSAGE_QUEUE_SUFFIX'),
            'region'    => env('YANDEX_MESSAGE_QUEUE_REGION', 'ru-central1'),
            'queue_map' => [
                'default' => env('YANDEX_MESSAGE_QUEUE_DEFAULT'),
            ],
        ],
    ],

    // ...
];
 php
TestJob::dispatch(['foo' => 'bar'])
    ->onConnection('ymq')
    ->onQueue('default');