Download the PHP package gabebritto/laravel-simple-sqs without Composer

On this page you can find all versions of the php package gabebritto/laravel-simple-sqs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-simple-sqs

Laravel Simple SQS Messenger

This Laravel package is designed to facilitate asynchronous microservices communication via AWS SQS using pure JSON payloads (without Laravel's native PHP serialization).

With this library, you can integrate and map incoming external JSON messages directly to standard Laravel Jobs, maintaining full compatibility with Laravel's native queue workers (php artisan queue:work).


JSON Payload Structure

All messages sent and received must strictly adhere to this flat format:


Installation & Setup

1. Requirements

Ensure that the sqs queue driver and the AWS SDK are already configured in your host Laravel application (config/queue.php).

2. Registering the Package

In your main Laravel application's composer.json, add the local path repository:

Then, install the package using:

3. Publish Configurations

Publish the package configuration file using the artisan publish command:

This will generate the config/sqs-messenger.php file:


How it Works

The package provides the Gabebritto\LaravelSimpleSqs\Traits\SqsJsonJob trait, which automates serialization (dispatching) and deserialization/hydration (consuming) of the queue messages.

1. Publisher (Dispatching Messages)

You have three clean and robust ways to dispatch raw JSON messages to the queue:

Option A: Static Dispatching via the Job class (Recommended)

The SqsJsonJob trait automatically resolves the mapped alias from the configuration file and sends the payload in pure JSON format:

Option B: Dynamic Instantiation & Publishing

If you prefer to instantiate the Job and define its public properties, the trait extracts the public properties of the class (filtering out Laravel's internal properties) and sends them as the JSON payload. event is just a standard property of the job:

Option C: Directly via the SqsPublisher Facade

You can also dispatch arbitrary payloads without having a local Job class or a configuration mapping defined:


2. Consumer (Receiving Messages / Worker)

Your Consumer Job can be a standard Laravel Job (implementing ShouldQueue and using traits like InteractsWithQueue and Queueable), simply by importing the SqsJsonJob trait.

The trait takes care of the following actions automatically upon receiving the message:

Example (app/Jobs/ConsolidateJob.php):


Why does it work with Laravel's native Worker?

When the native worker runs (php artisan queue:work), it pulls the SQS message, decodes the raw JSON, and attempts to resolve the value inside the "job" key from Laravel's Service Container.

In the register method of the SqsMessengerServiceProvider, we bind each configured alias to its class:

Since the received JSON contains "job": "external-event", the worker resolves and creates an instance of \App\Jobs\ConsolidateJob. By default, when no specific method is defined in the job payload (like Class@method), the queue runner falls back to calling the fire() method.

The SqsJsonJob trait defines the fire($job, array $data) method. This method hydrates the class properties, hooks standard traits, and invokes your standard handle() method, providing a robust integration pattern.


All versions of laravel-simple-sqs with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/queue Version ^8.0|^9.0|^10.0|^11.0|^12.0
aws/aws-sdk-php Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gabebritto/laravel-simple-sqs contains the following files

Loading the files please wait ...