PHP code example of atymic / laravel-bulk-sqs-queue

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

    

atymic / laravel-bulk-sqs-queue example snippets


'connections' => [
        'sqs-bulk' => [
            'driver'       => 'sqs-bulk',
            'key'          => env('AWS_ACCESS_KEY_ID'),
            'secret'       => env('AWS_SECRET_ACCESS_KEY'),
            'prefix'       => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
            'queue'        => env('SQS_QUEUE', 'default'),
            'suffix'       => env('SQS_SUFFIX'),
            'region'       => env('AWS_DEFAULT_REGION', 'us-east-1'),
            'after_commit' => false,
            'concurrency'  => 5, // Set the request concurrency, defaults to 5
        ],
]

Illuminate\Support\Facades\Queue::bulk([
    new \App\Jobs\Foo,
    new \App\Jobs\Bar,
    new \App\Jobs\Baz,
], '', 'default');

Illuminate\Support\Facades\Bus::batch([
    new \App\Jobs\Foo,
    new \App\Jobs\Bar,
    new \App\Jobs\Baz,
])->name('My sqs batch')->onQueue('default')->dispatch();
bash
php artisan queue:work sqs-bulk --queue=default