Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dtirer@gmail.com's avatar

SQS - Send Messages in Batch to a Queue

The PHP AWS SDK has a method called sendMessageBatch which allows you to send multiple messages to SQS, as long as they're on the same Queue:

http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#sendmessagebatch

Which is nice, because it means you don't have to connect to SQS multiple times in one request.

However, Laravel's Queue abstractions don't seem to support this. As far as I could see, there's a bulk method on Queue, however, the implementation for that simply loops through an array of jobs and sends them one by one:

https://github.com/laravel/framework/blob/5.4/src/Illuminate/Queue/Queue.php

Is there something I'm missing, or do I just need to access the SQS class directly and bypass Laravel's abstractions?

0 likes
2 replies
spekkionu's avatar
Level 48

That is an amazon specific piece of functionality while the queue system support many drivers.

You will need to use the aws api directly to accomplish that.

2 likes

Please or to participate in this conversation.