Download the PHP package ipunkt/laravel-rabbitmq-enqueue without Composer

On this page you can find all versions of the php package ipunkt/laravel-rabbitmq-enqueue. 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-rabbitmq-enqueue

Laravel Rabbitmq Enqueue

This package uses php-enqueue to provide RabbitMQ support for laravel.

It specifically uses the enqueue amqp-ext functionality and thus required the amqp php extension.

Install

This package is available through composer

composer require 'ipunkt/laravel-rabbitmq-enqueue:^1.0'

After installing publish the config and Provider through vendor:publish. It will create config/rabbitmq.php and app/Providers/RabbitMQProvider.php.

Add the RabbitMQProvider to your providers in the config/app.php and if necessary change its namespace from App\ to whatever your app uses.

Environment

The default config/rabbitmq.php builds the dsn required to connect to rabbitmq through the following environment variables, default values behind the name:

Use

Listen

Listening is done by running the rabbitmq:listen command. It will connect to the dsn specified in the config file and create all required queues, exchanges and bindings between the two.

Which queues, exchanges and bindings it both creates and listens to is defined in the published RabbitMQProvider

Waiting

Because rabbitmq:listen is expected to run in a cloud environment it brings the switch -w SECONDS to wait the given amount of seconds before trying to connect, or even do anything at all.

It is possible to achieve the same by putting a sleep before the command but the frequency of this use case made me include this small nod to cloud environments needing to set up dns and jaeger agents needing to start for ease of use.

Handler

Reacting to messages is done through a Handler. A handler is any class implementing the interface Ipunkt\RabbitMQ\MessageHandler\Handler. Register your handlers to routing keys in the published RabbitMQProvider

It is handed an AmqpMessage object in which you will most likely want to decode the $message->getBody() from json as it is currently the only format sent by the sender ofthis package.

Results

The following results can be handed back from your Handler to the command:

Sending

Sending is provided through Ipunkt\RabbitMQ\Sender\RabbitMQ. It is not a facade so injecting it as a dependency is recommended.

send to Exchange

Sending to an exchange is the expected use case as it provides lose coupling with the services that consume your messages

send to Queue

Sending directly to a target queue is also possible

Why specifically RabbitMQ instead of the generalized functions

The generalized enqueue interfaces do not support routing key based routing.

The available SimpleClient simulates routing key based routing by using fanout exchanges and dropping unwanted messages in the client code.
It simulates a behaviour supported by RabbitMQ itself. And thus causes unecessary overhead in the services sharing exchanges but only interested in certain routing keys.


All versions of laravel-rabbitmq-enqueue with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
php Version ^7.1.3|^8.0
enqueue/amqp-ext Version ^0.10.9
laravel/framework Version ^5.0.0|^6.0.0|^7.0.0|^8.0.0
ext-amqp Version *
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 ipunkt/laravel-rabbitmq-enqueue contains the following files

Loading the files please wait ....