softonic/laravel-queue-job

Custom Job implementation for vyuldashev@laravel-queue-rabbitmq library
14,960
Install
composer require softonic/laravel-queue-job
Latest Version:3.0.1
PHP:>=8.5
Laravel:12
Older releases:8 – 11
License:Apache-2.0
Last Updated:Oct 14, 2026
Links: GitHub  ·  Packagist
Maintainer: Joskfg

Laravel Queue Job

Latest Version Software License Build Status Total Downloads Average time to resolve an issue Percentage of issues still open

Custom Job implementation for vyuldashev/laravel-queue-rabbitmq library

:warning: This library works on vyuldashev/laravel-queue-rabbitmq. If you have questions about how to configure connections, feel free to read the vyuldashev/laravel-queue-rabbitmq documentation.

Requirements

  • PHP >= 8.5
  • Laravel 12.x

Main features

  • Add support to have multiple Handlers for the same Routing key.
  • Assign your Routing keys with your Handlers in the queue config file.

Installation

You can require the last version of the package using composer

composer require softonic/laravel-queue-job

Usage

Replace your RabbitMQJob class in the queue config file.

'connections' => [
    // ...

    'rabbitmq' => [
        // ...

        'options' => [
            'queue' => [
                // ...

                'job' => \Softonic\LaravelQueueJob\RabbitMQJob::class,
            ],
        ],
    ],

    // ...    
],

Add your message_handlers mapping in queue config file:

'message_handlers' => [
        TestHandler::class => [ // Handler
            '#.test_v1.created.testevent', // Routing keys
            '#.test_v1.replaced.testevent',
            '#.test_v1.updated.testevent',
            'global.test_v1.updated.testevent',
            // ...
        ],
        AnotherTestHandler::class => [
            '#.test_v1.created.testevent',
            'global.test_v1.updated.testevent',
            // ...
        ],
        // ...
    ],

Declaring the queue on startup

If you want the queue to be declared and bound to your routing keys automatically when the connection is opened (useful in local/dev environments), use RabbitMQQueueWithDeclare as the worker of your connection:

'connections' => [
    // ...

    'rabbitmq' => [
        // ...

        'worker' => \Softonic\LaravelQueueJob\RabbitMQQueueWithDeclare::class,

        'options' => [
            'queue' => [
                // ...

                'exchange'     => 'my-exchange',
                'routing_keys' => [ // An array, or a string for a single routing key
                    '#.test_v1.created.testevent',
                    'global.test_v1.updated.testevent',
                ],
                'max_length'   => 1000, // Optional. Adds x-max-length when greater than 0
            ],
        ],
    ],

    // ...
],

The queue is declared as durable and bound to the configured exchange once per resolved connection.

:warning: This happens in every process that resolves the connection, not only in queue:work. If the queue already exists with different arguments (e.g. another max_length), RabbitMQ rejects the declaration with a PRECONDITION_FAILED error.

Testing with artisan

Your php artisan queue:work {connection-name} --queue={queue-name}

Testing

softonic/laravel-queue-job has a PHPUnit test suite, and a coding style compliance test suite using PHP CS Fixer.

To run the tests:

docker compose run --rm tests

To run PHPUnit only:

docker compose run --rm phpunit

To fix code style issues:

docker compose run --rm fixcs

To open a terminal in the dev environment:

docker compose run --rm php sh

License

The Apache 2.0 license. Please see LICENSE for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

644,549,754 9,698
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

507,193,856 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

423,477,751 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

399,241,428 4,660

Version History

Version Released PHP Laravel License
3.0.1 >=8.5 ^12.0 Apache-2.0
3.0.0 >=8.5 ^12.0 Apache-2.0
2.0.0 ^8.3 ^11.0 Apache-2.0
1.4.0 ^8.0 ^9.0|^10.0 Apache-2.0
1.3.0 ^8.0 ^9.0|^10.0 Apache-2.0