PHPackages                             alesima/laravel-azure-service-bus - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. alesima/laravel-azure-service-bus

ActiveLibrary[Queues &amp; Workers](/categories/queues)

alesima/laravel-azure-service-bus
=================================

A Laravel Queue driver for Azure Service Bus

1.0.7(1y ago)1677↓82.4%MITPHPPHP ^7.2

Since Dec 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/alesima/laravel-azure-service-bus)[ Packagist](https://packagist.org/packages/alesima/laravel-azure-service-bus)[ Docs](https://github.com/alesima/laravel-azure-service-bus)[ RSS](/packages/alesima-laravel-azure-service-bus/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (10)Versions (7)Used By (0)

Laravel Azure Service Bus Queue Driver 🚀
========================================

[](#laravel-azure-service-bus-queue-driver-)

[![Packagist](https://camo.githubusercontent.com/f65f4dc92e6fd1f7debdc42f411743a62a26f2ee2d4c097fa8245d4aef5c02a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6573696d612f6c61726176656c2d617a7572652d736572766963652d6275732e737667)](https://packagist.org/packages/alesima/laravel-azure-service-bus)[![Coverage Status](https://camo.githubusercontent.com/8a1592098e75027f34bdda102313035784907e730142cebce306e0c7d5ff18b8/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f616c6573696d612f6c61726176656c2d617a7572652d736572766963652d6275732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/alesima/laravel-azure-service-bus?branch=master)[![GitHub issues](https://camo.githubusercontent.com/3cecd36c94b8bca33d78092f37c8866c53371031d0f5bde481be764f597ec7d6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616c6573696d612f6c61726176656c2d617a7572652d736572766963652d6275732e737667)](https://github.com/alesima/laravel-azure-service-bus/issues)[![License](https://camo.githubusercontent.com/4836a11d9dfa2a81d6a5a2d8c8340197278ce40716c7b30bbc8745eafb96a358/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616c6573696d612f6c61726176656c2d617a7572652d736572766963652d6275732e737667)](https://github.com/alesima/laravel-azure-service-bus/blob/main/LICENSE)

> Integrate **Azure Service Bus** as a queue driver and Pub/Sub module in Laravel, now with support for multiple topics.

This package provides a **custom queue driver** for Laravel that integrates with **Azure Service Bus** and adds support for **Topics and Subscriptions (Pub/Sub)**, enabling both queue-based and publish/subscribe messaging models with the ability to manage multiple topics dynamically.

---

Features 🎯
----------

[](#features-)

- **Azure Service Bus Integration**: Seamlessly integrate Azure's messaging capabilities into your Laravel application.
- **Support for Laravel 5.x - 8.x**: Compatible with older Laravel versions and PHP 7.2 and above.
- **Queue Operations**: Push, pop, and manage jobs in Azure Service Bus queues with ease.
- **Pub/Sub Module**: Publish messages to multiple topics and subscribe to them using Azure Service Bus topics and subscriptions.
- **Job Scheduling**: Supports delayed jobs using `later()` with multiple formats (e.g., `DateTime`, `DateInterval`, `int`).
- **Built with Laravel's Queuing System**: Follows the same conventions, making it easy to work with.

---

Installation ⚙️
---------------

[](#installation-️)

### 1. Install the package via Composer:

[](#1-install-the-package-via-composer)

```
composer require alesima/laravel-azure-service-bus
```

### 2. Publish the configuration:

[](#2-publish-the-configuration)

After installing, publish the configuration file to adjust your Azure Service Bus settings.

```
php artisan vendor:publish --provider="LaravelAzureServiceBus\Providers\ServiceProvider" --tag=config
```

### 3. Configure `.env` file:

[](#3-configure-env-file)

In your `.env` file, set the Azure Service Bus connection details:

```
SERVICE_BUS_NAMESPACE=https://
SERVICE_BUS_SHARED_ACCESS_KEY_NAME=
SERVICE_BUS_SHARED_ACCESS_KEY=
```

### **4. Define Azure Service Bus Configuration**

[](#4-define-azure-service-bus-configuration)

Update your `config/queue.php` file to include the following configuration for the Azure Service Bus driver:

```
'connections' => [
    // Other connections...

    'azureservicebus' => [
        'driver' => 'azureservicebus',
        'endpoint' => sprintf('https://%s.servicebus.windows.net/', env('SERVICE_BUS_NAMESPACE')),
        'shared_access_key_name' => env('SERVICE_BUS_SHARED_ACCESS_KEY_NAME'),
        'shared_access_key' => env('SERVICE_BUS_SHARED_ACCESS_KEY'),
        'queue' => 'default',
        'UseTopic' => false,
    ],
],
```

---

### 5. Register the service provider and the queue manager (optional):

[](#5-register-the-service-provider-and-the-queue-manager-optional)

If you are using Lumen, you need to register the service provider in `bootstrap/app.php`:

```
$app->register(Alesima\LaravelAzureServiceBus\Providers\ServiceProvider::class);
```

Also you might to register the queue manager in `config/app.php`:

```
$app->bind(Illuminate\Queue\QueueManager::class, function ($app) {
    return $app['queue'];
});
```

---

Local Development &amp; Testing with Docker 🐳
---------------------------------------------

[](#local-development--testing-with-docker-)

For local development and testing, you can use the official PHP 7.4 Docker image to ensure compatibility.

Run the following command to install dependencies using Docker:

```
docker run --rm \
    -v $(pwd):/app \
    -w /app \
    php:7.4-cli \
    bash -c "apt-get update && apt-get install -y zip unzip git && curl -sS https://getcomposer.org/installer | php && php composer.phar install"
```

How to test:

```
docker run --rm \
    -v $(pwd):/app \
    -w /app \
    php:7.4-cli \
    bash -c "apt-get update && apt-get install -y zip unzip git && curl -sS https://getcomposer.org/installer | php && php composer.phar install && vendor/bin/phpunit --no-coverage"
```

---

Usage 🛠️
--------

[](#usage-️)

### **Queue Operations**

[](#queue-operations)

#### Push Jobs onto the Queue ⬆️

[](#push-jobs-onto-the-queue-️)

You can push jobs to Azure Service Bus using the standard Laravel syntax:

```
use App\Jobs\MyJob;

dispatch(new MyJob($data)); // Push to the default queue
```

#### Use `later()` for Delayed Jobs ⏳

[](#use-later-for-delayed-jobs-)

You can schedule jobs to be pushed after a delay using various formats:

```
dispatch((new MyJob($data))->delay(60)); // Delay by 60 seconds

$interval = new \DateInterval('PT10M'); // 10 minutes
dispatch((new MyJob($data))->delay($interval));

$releaseTime = new \DateTime('+1 hour');
dispatch((new MyJob($data))->delay($releaseTime));
```

#### Handle Jobs 🚀

[](#handle-jobs-)

When a job is received from the queue, it will be processed as a standard Laravel job:

```
public function handle()
{
    // Your job logic here
}
```

---

### **Pub/Sub Module**

[](#pubsub-module)

The Pub/Sub module enables publishing messages to Azure Service Bus topics and receiving them from subscriptions. This now supports managing multiple topics dynamically.

#### Publish Messages to a Topic 📢

[](#publish-messages-to-a-topic-)

You can publish a message to a specific topic:

```
use LaravelAzureServiceBus\Services\AzurePubSubService;

$pubSub = app(AzurePubSubService::class);

// Publish to a specific topic
$pubSub->publishMessage('topic1', [
    'event' => 'user.created',
    'data' => ['user_id' => 123],
]);
```

#### Subscribe to a Specific Topic 🔔

[](#subscribe-to-a-specific-topic-)

To retrieve messages from a subscription under a specific topic:

```
use LaravelAzureServiceBus\Services\AzurePubSubService;

$pubSub = app(AzurePubSubService::class);

// Subscribe to messages from 'topic1'
$messages = $pubSub->retrieveMessages('topic1', 'subscription1');

foreach ($messages as $message) {
    echo $message; // Process the message
}
```

#### Retrieve Messages from Multiple Topics 🔄

[](#retrieve-messages-from-multiple-topics-)

To work with multiple topics dynamically:

```
use LaravelAzureServiceBus\Services\AzurePubSubService;

$pubSub = app(AzurePubSubService::class);

// Retrieve messages from multiple topics
$topics = ['topic1', 'topic2', 'topic3'];

foreach ($topics as $topic) {
    $messages = $pubSub->retrieveMessages($topic, 'subscription1');
    foreach ($messages as $message) {
        echo "From {$topic}: " . $message;
    }
}
```

---

Compatibility 🧩
---------------

[](#compatibility-)

This package is compatible with:

- **Laravel**: 5.x, 6.x, 7.x, and 8.x.
- **PHP**: 7.2 to 7.4.

---

Testing ⚡️
----------

[](#testing-️)

You can run tests using PHPUnit:

```
vendor/bin/phpunit
```

---

License 📜
---------

[](#license-)

This package is licensed under the **MIT License**. See [LICENSE](https://github.com/alesima/laravel-azure-service-bus/blob/main/LICENSE) for more information.

---

Contributing 🤝
--------------

[](#contributing-)

We welcome contributions to make this package even better!

1. Fork the repository.
2. Create a new branch.
3. Make your changes and commit them.
4. Open a pull request.

---

Credits 🏆
---------

[](#credits-)

- **[Azure SDK for PHP](https://github.com/Azure/azure-sdk-for-php)**: Provides the integration with Azure Service Bus.
- **[Laravel](https://laravel.com/)**: The PHP framework that powers this package.

---

Attribution
-----------

[](#attribution)

Inspired by  &amp;

---

Contact 📬
---------

[](#contact-)

For any questions, feel free to reach out to us via GitHub Issues or email us at .

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

6

Last Release

569d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3563dcbe10d4a33da215546fb0d101ee32484eeece0369a7d787a3ecfd4efaf?d=identicon)[alesima](/maintainers/alesima)

---

Tags

laravelqueueazureservicebus

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alesima-laravel-azure-service-bus/health.svg)

```
[![Health](https://phpackages.com/badges/alesima-laravel-azure-service-bus/health.svg)](https://phpackages.com/packages/alesima-laravel-azure-service-bus)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M209](/packages/illuminate-broadcasting)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
