PHPackages                             ihabrouk/messenger - 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. ihabrouk/messenger

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

ihabrouk/messenger
==================

A Laravel package for multi-provider messaging (SMS, WhatsApp, Email) with consent management and analytics

v2.0.2(8mo ago)140MITPHPPHP ^8.2|^8.3|^8.4

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/ihabrouk/messenger)[ Packagist](https://packagist.org/packages/ihabrouk/messenger)[ RSS](/packages/ihabrouk-messenger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (7)Used By (0)

Laravel Messenger Package
=========================

[](#laravel-messenger-package)

A comprehensive Laravel package for multi-provider messaging (SMS, WhatsApp) with FilamentPHP integration.

[![Latest Version on Packagist](https://camo.githubusercontent.com/2f0f8bf75a2caaaaf1e9459a8efe9026f79cf801bcbfd4ae44394bc8bda813f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69686162726f756b2f6d657373656e6765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ihabrouk/messenger)[![Total Downloads](https://camo.githubusercontent.com/41dd53130f1dd76b51b8aa43588f2e647b32b2bcb24b22b8be130bfe2e5fa58d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f69686162726f756b2f6d657373656e6765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ihabrouk/messenger)

Features
--------

[](#features)

- 🚀 **Multi-Provider Support**: SMS Misr, Twilio (SMS &amp; WhatsApp), and extensible architecture
- 📱 **Multiple Channels**: SMS, WhatsApp, OTP with automatic fallback
- 🎨 **FilamentPHP Integration**: Admin panels, forms, actions, and components
- 📋 **Template System**: Dynamic templates with variable substitution
- 📊 **Bulk Messaging**: Send to thousands of recipients with progress tracking
- ⚡ **Queue Integration**: Background processing with priority queues
- 📈 **Analytics**: Delivery tracking, cost monitoring, and reporting
- 🔒 **Security**: GDPR compliance, consent management, and rate limiting
- 🛡️ **Circuit Breaker**: Automatic failover for provider reliability
- 🎯 **Automation**: Triggered messaging based on events

Version Support
---------------

[](#version-support)

VersionLaravelFilamentPHPStatus**2.x**11.0+4.0+8.2+✅ Active Development**1.x**10.0-11.x3.0+8.1+🔧 Maintenance### Choosing Your Version

[](#choosing-your-version)

- **Use v2.x** if you're on Laravel 11+ and can upgrade to Filament v4
- **Use v1.x** if you need to stay on Laravel 10 or Filament v3

```
# For new projects (recommended)
composer require "ihabrouk/messenger:^2.0"

# For projects using Filament v3
composer require "ihabrouk/messenger:^1.0"
```

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

[](#installation)

You can install the package via composer:

```
composer require ihabrouk/messenger
```

### Quick Setup

[](#quick-setup)

```
# Publish and run migrations (REQUIRED)
php artisan vendor:publish --provider="Ihabrouk\Messenger\Providers\MessengerServiceProvider" --tag="messenger-migrations"
php artisan migrate

# Publish configuration
php artisan vendor:publish --provider="Ihabrouk\Messenger\Providers\MessengerServiceProvider" --tag="messenger-config"
```

### Installation Issues?

[](#installation-issues)

If you encounter "Class not found" errors:

```
# Run diagnostic command
php artisan messenger:diagnose

# See emergency fix guide
# Check EMERGENCY_FIX.md for detailed troubleshooting
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag="messenger-config"
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="messenger-migrations"
php artisan migrate
```

Optionally, publish the views and language files:

```
php artisan vendor:publish --tag="messenger-views"
php artisan vendor:publish --tag="messenger-lang"
```

Environment Variables
---------------------

[](#environment-variables)

Add these variables to your `.env` file:

```
# Default Provider
MESSENGER_DEFAULT_PROVIDER=smsmisr

# SMS Misr Configuration
SMS_MISR_API_USERNAME=your_username
SMS_MISR_API_PASSWORD=your_password
SMS_MISR_SENDER_ID=your_sender_id
SMS_MISR_ENVIRONMENT=2  # 1 for Live, 2 for Test

# Twilio Configuration
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_FROM=your_phone_number

# Queue Configuration
MESSENGER_QUEUE_CONNECTION=redis
MESSENGER_QUEUE_NAME=messenger

# Analytics
MESSENGER_ANALYTICS_ENABLED=true
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use Ihabrouk\Messenger\Facades\Messenger;

// Send a simple SMS
Messenger::send([
    'recipient_phone' => '+1234567890',
    'content' => 'Hello, this is a test message!',
    'provider' => 'smsmisr', // optional
    'channel' => 'sms'       // optional
]);

// Send using templates
Messenger::sendFromTemplate('welcome_user', [
    'recipient_phone' => '+1234567890',
    'variables' => [
        'user_name' => 'John Doe',
        'company' => 'Acme Corp'
    ]
]);
```

### Bulk Messaging

[](#bulk-messaging)

```
use Ihabrouk\Messenger\Models\Batch;

$batch = Batch::create([
    'name' => 'Newsletter Campaign',
    'template_id' => $template->id,
    'provider' => 'smsmisr',
    'channel' => 'sms'
]);

$recipients = [
    ['phone' => '+1234567890', 'variables' => ['name' => 'John']],
    ['phone' => '+0987654321', 'variables' => ['name' => 'Jane']],
];

Messenger::bulkSend($batch, $recipients);
```

### FilamentPHP Integration

[](#filamentphp-integration)

Add to your Filament resources:

```
use Ihabrouk\Messenger\Actions\SendMessageAction;

// In your table actions
SendMessageAction::make()
    ->phoneField('phone_number')
    ->nameField('full_name')
```

Provider Configuration
----------------------

[](#provider-configuration)

### SMS Misr Setup

[](#sms-misr-setup)

1. Register at [SMS Misr](https://smsmisr.com)
2. Get your API credentials
3. Configure webhooks for delivery tracking

```
// config/messenger.php
'providers' => [
    'smsmisr' => [
        'driver' => 'smsmisr',
        'username' => env('SMS_MISR_API_USERNAME'),
        'password' => env('SMS_MISR_API_PASSWORD'),
        'sender_id' => env('SMS_MISR_SENDER_ID'),
        // ... other options
    ]
]
```

### Twilio Setup

[](#twilio-setup)

1. Create a Twilio account
2. Get your Account SID and Auth Token
3. Configure your phone number or WhatsApp sender

```
// config/messenger.php
'providers' => [
    'twilio' => [
        'driver' => 'twilio',
        'account_sid' => env('TWILIO_ACCOUNT_SID'),
        'auth_token' => env('TWILIO_AUTH_TOKEN'),
        'from' => env('TWILIO_FROM'),
        // ... other options
    ]
]
```

Advanced Features
-----------------

[](#advanced-features)

### Custom Providers

[](#custom-providers)

Create your own messaging provider:

```
php artisan messenger:make-driver CustomProvider
```

### Templates

[](#templates)

Manage templates through Filament admin or programmatically:

```
use Ihabrouk\Messenger\Models\Template;

Template::create([
    'name' => 'welcome_sms',
    'content' => [
        'en' => 'Welcome {{name}}! Your account is ready.',
        'ar' => 'مرحباً {{name}}! حسابك جاهز الآن.'
    ],
    'channels' => ['sms'],
    'category' => 'welcome'
]);
```

### Analytics &amp; Monitoring

[](#analytics--monitoring)

Access delivery analytics:

```
use Ihabrouk\Messenger\Services\AnalyticsService;

$analytics = app(AnalyticsService::class);
$stats = $analytics->getDeliveryStats('last_30_days');
```

### Event Listeners

[](#event-listeners)

Listen to messaging events:

```
use Ihabrouk\Messenger\Events\MessageSent;

Event::listen(MessageSent::class, function ($event) {
    // Handle successful message sending
    Log::info('Message sent', ['message_id' => $event->message->id]);
});
```

Troubleshooting
---------------

[](#troubleshooting)

### Diagnostic Command

[](#diagnostic-command)

```
# Run this to diagnose installation issues
php artisan messenger:diagnose
```

### Common Issues

[](#common-issues)

- **"Class not found" errors**: See [EMERGENCY\_FIX.md](EMERGENCY_FIX.md)
- **Migration issues**: See [INSTALLATION\_TROUBLESHOOTING.md](INSTALLATION_TROUBLESHOOTING.md)
- **Provider setup**: See [INSTALLATION.md](INSTALLATION.md)

### Available Commands

[](#available-commands)

```
php artisan messenger:diagnose              # Diagnose installation issues
php artisan messenger:list-providers        # List available providers
php artisan messenger:test-provider         # Test provider configuration
php artisan messenger:send                  # Send a test message
```

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ihabrouk](https://github.com/ihabrouk)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Support
-------

[](#support)

For support, email  or join our Discord channel.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance77

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Recently: every ~0 days

Total

6

Last Release

252d ago

Major Versions

v0.1.0 → v2.0.02025-09-09

v1.x-dev → v2.0.12025-09-09

PHP version history (3 changes)v0.1.0PHP ^8.2

v2.0.0PHP ^8.2|^8.3|^8.4

v1.0.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/17dd7a575d3d8cc3707bf1a638b97705391721be219f1125796209c774c70821?d=identicon)[ihabrouk](/maintainers/ihabrouk)

---

Top Contributors

[![ihabrouk](https://avatars.githubusercontent.com/u/35994789?v=4)](https://github.com/ihabrouk "ihabrouk (28 commits)")

---

Tags

laravelemailsmstwiliomessagingwhatsappgdprconsent

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ihabrouk-messenger/health.svg)

```
[![Health](https://phpackages.com/badges/ihabrouk-messenger/health.svg)](https://phpackages.com/packages/ihabrouk-messenger)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

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

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[simplesoftwareio/simple-sms

Simple-SMS is a package made for Laravel to send/receive (polling/pushing) text messages. Currently supports CalLFire, EZTexting, Email Gateways, FlowRoute, LabsMobile, Mozeo, Nexmo, Plivo, Twilio, and Zenvia

20845.7k5](/packages/simplesoftwareio-simple-sms)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10138.4k](/packages/gr8shivam-laravel-sms-api)[tomatophp/filament-twilio

Send Whatsapp messages using Twilio and native filament Notification Facade class

112.3k](/packages/tomatophp-filament-twilio)

PHPackages © 2026

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