Download the PHP package mookofe/tail without Composer
On this page you can find all versions of the php package mookofe/tail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tail
mookofe/tail
RabbitMQ and PHP client for Laravel and Lumen that allows you to add and listen queues messages just simple.
Features
- Simple queue configuration
- Multiple server connections
- Add message to queues easily
- Listen queues with useful options
Requirements
- php-amqplib/php-amqplib: 2.*
Version
1.0.5
Installation
Preparation
Open your composer.json file and add the following to the require array:
Install dependencies
Or
Integration
Laravel
After installing the package, open your Laravel config file config/app.php and add the following lines.
In the $providers array add the following service provider for this package.
In the $aliases array add the following facade for this package.
Add servers connection file running:
Lumen
Register the Lumen Service Provider in bootstrap/app.php:
Make sure sure $app->withFacades();
is uncomment in your bootstrap/app.php file
Create a config folder in the root directory of your Lumen application and copy the content from vendor/mookofe/tail/config/tail.php to config/tail-settings.php.
RabbitMQ Connections
By default the library will use the RabbitMQ installation credentials (on a fresh installation the user "guest" is created with password "guest").
To override the default connection or add more servers, edit the RabbitMQ connections file at: config/tail-settings.php
Adding messages to queue:
Adding a simple message
Adding message changing RabbitMQ server
Adding message with different exchange
Adding message with different content type
Adding message with different options
Using Tail object
Listening queues:
Closure based listener
Closure listener with options
Options definitions:
Name | Description | Default value |
---|---|---|
queue_name | Queue name on RabbitMQ | * Required |
message_limit | Number of messages to be processed | 0: Unlimited |
time | Time in seconds the process will be running | 0: Unlimited |
empty_queue_timeout | Time in seconds to kill listening when the queue is empty | 0: Unlimited |
connection_name | Server connection name | Defined at connections file |
exchange | Exchange name on RabbitMQ Server | Specified on connections file |
vhost | Virtual host on RabbitMQ Server | Specified on connections file |
By default the listen process will be running forever unless you specify one of the running time arguments above (message_limit, time, empty_queue_timeout). They can be mixed all together, so when one of the condition is met the process will be stopped.
License
This package is open-sourced software licensed under the MIT license