Skip to content

reedtechus/azure-service-bus-laravel

Repository files navigation

logo-print-hd-transparent

Azure Service Bus SDK for Laravel / PHP

Provides an interface to Azure's Service Bus.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package provides an interface to Azure Service Bus.

It implements the Azure Service Bus REST API via Saloon v2.

⚠️ Experimental: This package is still in development and is not ready for production use. Breaking changes can still occur without a major version change until 1.0.0.

Installation

You can install the package via composer:

composer require reedtechus/azure-service-bus-laravel

You can publish the config file with:

php artisan vendor:publish --tag="azure-service-bus-laravel-config"

This is the contents of the published config file:

return [
	'tenant' => env('SERVICE_BUS_TENANT'),
	'namespace' => env('SERVICE_BUS_NAMESPACE'),
	'cache_driver' => env('SERVICE_BUS_CACHE_DRIVER', 'redis'),
];

Usage

Send a Message to a Queue or Topic

AzureServiceBus::send('queue_or_topic_name', ['payload_data' => 'goes_here'])

Receive a Message from a Queue

Peek (Non-destructive read) a message from a queue:

AzureServiceBus::peek('queue_name')

Peek (Non-destructive read) a message from a topic (via subscription):

AzureServiceBus::peek('queue_name', 'subscription_name')

Destructive Read

The above peek examples can be replaced with pop to perform a destructive read and remove the message from the queue / subscription.

Pop (Destructive read) a message from a queue:

AzureServiceBus::pop('queue_name')

Pop (Destructive read) a message from a topic (via subscription):

AzureServiceBus::pop('queue_name', 'subscription_name')

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.