Download the PHP package primitivesense/laravel-raw-sqs-connector without Composer
On this page you can find all versions of the php package primitivesense/laravel-raw-sqs-connector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download primitivesense/laravel-raw-sqs-connector
More information about primitivesense/laravel-raw-sqs-connector
Files in primitivesense/laravel-raw-sqs-connector
Package laravel-raw-sqs-connector
Short Description Allows for the consumption of raw messages produced outside of Laravel from SQS to then be handled natively within Laravel's Queue and Job system
License MIT
Informations about the package laravel-raw-sqs-connector
Laravel Raw SQS Connector
About
The purpose of this package is to allow you to consume raw messages produced outside of Laravel from AWS SQS to then be handled natively within Laravel's Queue and Job system.
- Integrates natively into Laravel's Queue system, leveraging all the existing functionality.
- It extends base Laravel SQS functionality, only overriding a small subset of SQS methods.
- Its used in production.
- Comprehensive documentation.
- Full suite of unit tests.
This library was originally built to allow the submission of jobs from AWS Lambda into Laravel.
Dependencies
- PHP >= 7.3
- Laravel >= 8.0
Installation via Composer
To install:
How to use
Add the Service Provider into config/app.php
like so:
Create a new job like so:
RawSqsJob
is a base class that has all the required traits to allow for Laravel's Queue System to handle it correctly.
Your raw message from SQS can be accessed via $this->data
, magic!
To then configure this within config/queue.php
add the block below:
your-raw-sqs-queue
is simply your custom message queue, the important bits to note are driver
and job_class
. driver
is simply this packages raw-sqs
connector and job_class
just tells Laravel Queue which job to deletegate the raw message too.
Then simply invoke the below to start the queue
It does give you the flexibiity to push multiple messages into the queue but they will only be proccessed by that one job.
How it works
There is a new RawSqsConnector
and RawSqsQueue
. The RawSqsConnector
handles the construction of the RawSqsQueue
class which responsibility is to process/submit the messages to SQS. There is then a base RawSqsJob
class which can be extended from which has all the traits required for the Queue system to delegate and handle the job correctly.
RawSqsQueue
extends Larvel's SQS Queue, overriding a few core methods, the push
methods are disabled as the package is designed to consume jobs from SQS rather than push jobs onto the Queue. The main amount of work resides within the overriden pop
method which processes the incoming message. This method has been extended to take the message and marshal it into a format that Laravel's queue system understands to then be later handled by the job it's self.
Help!
If you have any issues please feel free to raise an issue!
Contributing
Contributions are more than welcome, please feel free to raise a PR but please ensure:
- Complies with PSR-2 -
./vendor/bin/phpcs --standard=PSR2
- Complies with the packages PHPStan Configuration -
./vendor/bin/phpstan analyse -l max -c phpstan.neon src
License
The Laravel Raw SQS Connector is open-sourced software licensed under the MIT license.
All versions of laravel-raw-sqs-connector with dependencies
ext-json Version *
illuminate/queue Version ^8.0
aws/aws-sdk-php Version ~3.1