Category: PHP

Let’s checkout how to connect Symfony with Amazon SQS and SNS Services by using a Symfony component. In our case we will create a TestMessage object, that gets send and consumed by a handler. Create a Symfony CLI skeleton: Install Symfony Messenger component: To enable the support of AWS SQS install these two packages: Sign in to your AWS management console and filter for SQS: Create a new Queue with the standard setup: Click the button that says “Quick-Create Queue” and you should see something like this: Below in the details Tab you will find the corresponding URL: Now we need a user with credentials that we can use in our Symfony application to send and receive messages from the queue.

You can always debug the variables that are visible to your Symfony project with this command: Last configuration steps are to change config/packages/enqueue.yaml: And the config/packages/messenger.yaml: Message(I hold the message data): Handler (I consume messages from the queue and dump the payload): Let’s see if everything fits together: As you can see we configured everything properly and it works!

First of all we need to setup a SNS Notification in our AWS management console: Click on create topic, pass a name and you get the necessary ARN that you put into your .env.local file as AWS_TOPIC_ARN=xxxxx.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners