Download the PHP package our-edu/laravel-sqs-messaging without Composer
On this page you can find all versions of the php package our-edu/laravel-sqs-messaging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download our-edu/laravel-sqs-messaging
More information about our-edu/laravel-sqs-messaging
Files in our-edu/laravel-sqs-messaging
Package laravel-sqs-messaging
Short Description Laravel package for AWS SQS messaging with RabbitMQ rollback support
License MIT
Informations about the package laravel-sqs-messaging
Laravel SQS Messaging Package
A comprehensive Laravel package for AWS SQS messaging with RabbitMQ rollback support, idempotency, error handling, and CloudWatch metrics integration.
Features
- ✅ AWS SQS integration with automatic queue/DLQ creation
- ✅ Message envelope with idempotency keys
- ✅ Redis + Database idempotency checking
- ✅ Error classification (validation, transient, permanent)
- ✅ CloudWatch metrics integration
- ✅ Dead Letter Queue (DLQ) management
- ✅ Long polling support
- ✅ RabbitMQ adapter for easy migration
- ✅ Environment-aware queue naming
Installation
Via Composer
Configuration
1. Publish Configuration
2. Environment Variables
Add to your .env:
Notes:
1- Set MESSAGING_FALLBACK_TO_RABBITMQ=true if you have other projects still using RabbitMQ. This ensures messages go to RabbitMQ when SQS queue doesn't exist.
2-Set SQS_ALLOW_TIMESTAMP_ATTRIBUTE=true and append timestamp attribute to the payload of the message if you want to generate the IdempotencyKey based on the timestamp.
3. Configure Queues
Edit config/sqs_queues.php:
HINT: This File Defines The SQS Queues Used By Your Application
4. Configure Event Mappings
Edit config/sqs_events.php:
HINT: This File Maps Events To Their Respective Listeners ( used in receiving messages )
5. Configure Target Queues
Edit config/sqs_target_queues.php:
HINT: This File Maps Events To Their Target Queues ( used in publishing messages )
6. Run Migration
This creates the processed_events table for idempotency.
7. Ensure Queues Exist
For Production: Add this to your entrypoint.sh or container startup script to ensure queues exist before starting consumers:
Usage
Publishing Messages
Option 1: Use Unified MessagingService (Recommended)
The package includes a MessagingService that can switch between available drivers (SQS and RabbitMQ).
Step 1: Update your Support\RabbitMQ\Publishable trait and add the following method:
Complete updated trait:
Step 2: In your listeners where you publish a message, replace RabbitMQ publishing code: HINT: Use The Same Payload Constructor Parameters Old RabbitMQ Publisher:
New MessagingService Publisher:
Example Migration: HINT: Use The Same Payload Constructor Parameters ( \$event->reversePaymentRequest, $usersUuids ) Old RabbitMQ Listener:
New Listener using MessagingService:
Switch drivers via environment variable:
Option 2: Direct SQS Adapter
HINT: This approach will publish directly to SQS (bypasses driver switching):
Consuming Messages
Add to Supervisor configuration:
Available Commands
Rollback & Cleanup
See ROLLBACK_GUIDE.md for detailed instructions on:
- Rolling back from SQS to RabbitMQ
- Cleaning up RabbitMQ code once SQS is stable
- Dual write mode for gradual migration
Production Deployment
Ensure Queues Before Startup
Add to your production entrypoint.sh or container startup script:
This ensures all required SQS queues and DLQs exist before starting consumers or the application.
Production Environment Variables
For detailed production deployment guide, see DEPLOYMENT.md.
Requirements
- PHP ^8.1
- Laravel ^9.0|^10.0
- AWS SDK PHP ^3.0
- Redis (for idempotency)
- AWS SQS access
License
MIT
Support
For issues and questions, please contact the OurEdu development team.
All versions of laravel-sqs-messaging with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
aws/aws-sdk-php Version ^3.0
predis/predis Version ^1.1 || ^2.0