Integrate Amazon SQS with other AWS services to make applications more flexible and reliable.

Use Amazon SQS to create work queues with each message as a task to be completed by a process. Let one (or many) computers read tasks from the message queue and then process them.

Build a microservice architecture and use message queues to connect your microservices.

Keep notifications of significant business events in an Amazon SQS message queue. Each event can have a corresponding message in a message queue, and applications that need to be aware of the event can read and process the messages.

and the last question this post answers is

How To Use SQS with PHP

Its very simple to get going with SQS as Amazon already provides the PHP SDK for the purpose. We’ll start by installing the AWS SQS PHP SDK to our project. Let’s divide our jobs into three parts

Setting up the SDK

Sending data to the queue

Retrieving data from the queue

Setting up the SDK

While working with PHP, its always the best to use third-party package managers such as composer. If you prefer composer and are familiar with it, update your composer.json to require the following.

{
"require": {
"aws/aws-sdk-php": "dev-master"
}
}

Once you have included “aws/aws-sdk-php” in your composer.json, its time to run ”composer update” so that the SDK is downloaded and placed into your project.

However, if you don’t prefer using composer. You can instead download the zip file from the SQS PHP SDK Git repo and unzip it into your project directory.

Once you have the SDK in your directory you need to include it into your PHP file, let’s say you are writing your code in the file sqs.php in the root directory.

At the top of your code in sqs.php, you need to addrequire '/path/to/aws-autoloader.php';If you used the ZIP for adding the SDK to your project.

And those who used composer would include the followingrequire 'vendor/autoload.php'

That’s all about the installation of the SDK into your project, its time to use it.

Sending data to the queue

I have written the following PHP function to send data to an SQS queue

The code above is easy and self-explanatory, yet if you need help, drop a comment and I’ll get back to you.

Moving on to our last step in this post.

Retrieving data from the queue

Well this is really as easy as Amazon claims it to be. Please have a look at my code below that retrieves messages from SQS and deletes them from the queue once processed (to avoid duplicate processing).