PHPackages                             infoesportes/messaging-laravel - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. infoesportes/messaging-laravel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

infoesportes/messaging-laravel
==============================

Laravel adapter for InfoEsportes messaging microservice with RabbitMQ, Horizon integration for Email, SMS, and WhatsApp

v1.0.4(3mo ago)03MITPHPPHP ^8.1CI failing

Since Jan 23Pushed 3mo agoCompare

[ Source](https://github.com/Info-Esportes/messaging-laravel)[ Packagist](https://packagist.org/packages/infoesportes/messaging-laravel)[ RSS](/packages/infoesportes-messaging-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (6)Used By (0)

Messaging Laravel
=================

[](#messaging-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/64efed4578d85995b75a030aba927dee7e262a3fd963166f72e3b3eea6375d44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e666f6573706f727465732f6d6573736167696e672d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/infoesportes/messaging-laravel)[![Tests](https://github.com/Info-Esportes/messaging-laravel/workflows/Tests/badge.svg)](https://github.com/Info-Esportes/messaging-laravel/actions)[![Total Downloads](https://camo.githubusercontent.com/b2b2b145276596780fc6e581599dbb19456fc0cb880684012e935ff793716ba3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e666f6573706f727465732f6d6573736167696e672d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/infoesportes/messaging-laravel)

Laravel adapter for InfoEsportes messaging microservice with RabbitMQ. Provides Horizon integration for Email, SMS, and WhatsApp messaging.

Features
--------

[](#features)

- 🚀 **RabbitMQ Integration** - Topic exchange with routing keys
- 📧 **Email Support** - Transactional and marketing emails
- 📱 **SMS Support** - OTP and alerts
- 💬 **WhatsApp Support** - Notifications and support messages
- 🔄 **Laravel Horizon** - Queue monitoring and management
- ⚡ **Background Jobs** - Async processing with Laravel queues
- 🎯 **Routing Keys** - Flexible message routing
- 🛡️ **Reliability** - Quorum queues for high availability

Architecture
------------

[](#architecture)

```
CodeIgniter/Laravel → Plain JSON → RabbitMQ
                                      ↓
                    Consumer (ACK immediately)
                                      ↓
                    Dispatch Laravel Job
                                      ↓
                    Redis/Database Queue (Horizon)
                                      ↓
                    ProcessEmailJob/ProcessSMSJob/ProcessWhatsAppJob

```

Installation
------------

[](#installation)

```
composer require infoesportes/messaging-laravel
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=messaging-config
```

### Environment Variables

[](#environment-variables)

Add to your `.env` file:

```
RABBITMQ_HOST=localhost
RABBITMQ_PORT=5672
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_VHOST=/
RABBITMQ_EXCHANGE=messages.topic
RABBITMQ_PREFETCH_COUNT=10
RABBITMQ_CONSUMER_TAG=laravel_consumer

MESSAGING_QUEUE_CONNECTION=redis
MESSAGING_QUEUE_NAME=messaging
```

Usage
-----

[](#usage)

### Publishing Messages

[](#publishing-messages)

#### Using Facade

[](#using-facade)

```
use Infoesportes\Messaging\Laravel\Facades\Messaging;

// Email - Transactional
Messaging::publishEmail('transactional', [
    'to' => 'user@example.com',
    'subject' => 'Your Invoice',
    'body' => 'Invoice details...',
]);

// Email - Marketing
Messaging::publishEmail('marketing', [
    'to' => 'user@example.com',
    'subject' => 'Newsletter',
    'template' => 'newsletter',
]);

// SMS - OTP
Messaging::publishSms('otp', [
    'to' => '+5511999999999',
    'code' => '123456',
]);

// SMS - Alert
Messaging::publishSms('alert', [
    'to' => '+5511999999999',
    'message' => 'Urgent alert!',
]);

// WhatsApp - Notification
Messaging::publishWhatsApp('notification', [
    'to' => '+5511999999999',
    'message' => 'You have a new message',
]);

// WhatsApp - Support
Messaging::publishWhatsApp('support', [
    'to' => '+5511999999999',
    'message' => 'Support ticket created',
]);
```

#### Using Service Container

[](#using-service-container)

```
$messaging = app('messaging');

$messaging->publish('email.transactional', [
    'to' => 'user@example.com',
    'subject' => 'Custom Email',
]);
```

### Consuming Messages

[](#consuming-messages)

Start the consumer for each queue type:

```
# Consume email messages
php artisan messaging:consume email

# Consume SMS messages
php artisan messaging:consume sms

# Consume WhatsApp messages
php artisan messaging:consume whatsapp

# With timeout (in seconds)
php artisan messaging:consume email --timeout=3600
```

### Supervisor Configuration

[](#supervisor-configuration)

Create `/etc/supervisor/conf.d/messaging-consumer.conf`:

```
[program:messaging-email-consumer]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan messaging:consume email
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/log/messaging-email-consumer.log

[program:messaging-sms-consumer]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan messaging:consume sms
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/messaging-sms-consumer.log

[program:messaging-whatsapp-consumer]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan messaging:consume whatsapp
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/messaging-whatsapp-consumer.log
```

Then reload supervisor:

```
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start messaging-email-consumer:*
sudo supervisorctl start messaging-sms-consumer:*
sudo supervisorctl start messaging-whatsapp-consumer:*
```

Routing Keys
------------

[](#routing-keys)

The package uses the following routing key structure:

### Email

[](#email)

- `email.transactional` - Invoices, receipts, confirmations
- `email.marketing` - Newsletters, promotions

### SMS

[](#sms)

- `sms.otp` - One-time passwords, verification codes
- `sms.alert` - Urgent alerts, notifications

### WhatsApp

[](#whatsapp)

- `whatsapp.notification` - General notifications
- `whatsapp.support` - Support messages, tickets

Job Processing
--------------

[](#job-processing)

The consumer dispatches jobs to Laravel's queue system. Customize the job classes:

### ProcessEmailJob

[](#processemailjob)

```
namespace Infoesportes\Messaging\Laravel\Jobs;

use Illuminate\Support\Facades\Mail;

class ProcessEmailJob implements ShouldQueue
{
    public function handle(): void
    {
        // Implement your email sending logic
        Mail::to($this->data['to'])
            ->send(new YourMailable($this->data));
    }
}
```

### ProcessSMSJob

[](#processsmsjob)

```
public function handle(): void
{
    // Implement your SMS provider logic
    $smsProvider = app(SMSProviderInterface::class);
    $smsProvider->send($this->data['to'], $this->data['message']);
}
```

### ProcessWhatsAppJob

[](#processwhatsappjob)

```
public function handle(): void
{
    // Implement your WhatsApp provider logic
    $whatsappProvider = app(WhatsAppProviderInterface::class);
    $whatsappProvider->send($this->data['to'], $this->data['message']);
}
```

Testing
-------

[](#testing)

```
composer test
```

Code Style
----------

[](#code-style)

```
composer format
```

Configuration
-------------

[](#configuration)

See [config/messaging.php](src/config/messaging.php) for all available options.

Key configuration sections:

- **RabbitMQ Connection** - Host, port, credentials
- **Exchange Configuration** - Topic exchange settings
- **Queue Configuration** - Queue names, routing keys, durability
- **Consumer Configuration** - Prefetch count, consumer tag
- **Job Mapping** - Map queue types to job classes

Horizon Integration
-------------------

[](#horizon-integration)

This package works seamlessly with Laravel Horizon. Jobs dispatched from the RabbitMQ consumer appear in Horizon for monitoring:

1. Install Horizon: `composer require laravel/horizon`
2. Publish config: `php artisan horizon:install`
3. Start Horizon: `php artisan horizon`
4. View dashboard: `http://your-app.test/horizon`

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 10.x or 11.x
- RabbitMQ 3.8 or higher
- Redis (for queue driver)

Credits
-------

[](#credits)

- [Lucas Pinheiro](https://github.com/zluckx)
- [InfoEsportes](https://github.com/Info-Esportes)

License
-------

[](#license)

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance79

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~0 days

Total

5

Last Release

110d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48ef476451ca86bd758ad0ad47636bfde84d77e20ace3ab94119b3d012461f99?d=identicon)[lucaspinheiro13](/maintainers/lucaspinheiro13)

---

Top Contributors

[![lucaspinheiro13](https://avatars.githubusercontent.com/u/58701015?v=4)](https://github.com/lucaspinheiro13 "lucaspinheiro13 (7 commits)")

---

Tags

laravelemailsmsrabbitmqmessagingwhatsapphorizonMicroservice

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/infoesportes-messaging-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/infoesportes-messaging-laravel/health.svg)](https://phpackages.com/packages/infoesportes-messaging-laravel)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)

PHPackages © 2026

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