Prerequisites
You need PHP 8.5 or later with theswoole and pcntl extensions. You also need Docker to run ElasticMQ and the AWS CLI to create the queue and send messages.
Start ElasticMQ before you run the app:
Project structure
The sample uses this layout:Install dependencies
Require the framework and the modules package:Source files
Switch between the four source files. Each tab shows the exact file from the sample.- SqsSampleApplication.php
- MessageFileWriterConsumer.php
- bin/application.php
- composer.json
The single entry point. It points Winter Boot at the
config directory and at the sample namespace.Configuration
Switch between the two config files.application.yml enables the module, and sqs-config.yml defines the connection and consumer.
- application.yml
- sqs-config.yml
The full sample file registers See Configuration for every
SqsModule and sets the server and app identity:application.yml key.Run the app
Create the queue, start the app, send a message, then check the output file. 1. Create the queue:my-queue as soon as the app boots.
3. Send a message:
Next steps
- Read the SQS module for producer APIs (
SqsService), IAM-role setup, and consumer tuning (waitTimeSeconds,maxNumberOfMessages,visibilityTimeout). - Browse all Libraries when you need Kafka, S3, Redis, or Doctrine in the same app.