PHPackages                             softlandtech/notify - 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. softlandtech/notify

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

softlandtech/notify
===================

Laravel notification channels for Email, WhatsApp (Facebook Graph API) and SMS (Taqnyat)

21PHP

Since Mar 17Pushed 1mo agoCompare

[ Source](https://github.com/abdallahisham/notify)[ Packagist](https://packagist.org/packages/softlandtech/notify)[ RSS](/packages/softlandtech-notify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Notify - Laravel Notifications
==============================

[](#notify---laravel-notifications)

A powerful Laravel package that extends Laravel's notification system with advanced features for Email, SMS (Taqnyat), and WhatsApp channels.

Features
--------

[](#features)

- **Universal Channel Support**: Works with **any** Laravel notification channel from [laravel-notification-channels.com](https://laravel-notification-channels.com) (100+ channels available)
- **Built-in Channels**: Email (Mail), SMS (Taqnyat), WhatsApp Business API
- **Flexible Delivery Strategies**: Send to all channels or use round-robin fallback
- **Channel Priority/Ordering**: Define the order in which channels are attempted
- **Retry Logic**: Automatic retry with exponential or linear backoff
- **Rate Limiting**: Prevent notification spam
- **User Preferences**: Allow users to choose their preferred channels
- **Sandbox Mode**: Test notifications without actually sending them
- **Events System**: Monitor notification lifecycle with dispatchable events
- **Notification History**: Log all sent notifications to database
- **Channel Health Monitoring**: Check channel configuration and API connectivity
- **Conditional Channel Rules**: Custom logic to determine when each channel should be used
- **Template Management**: Named WhatsApp templates with helper methods
- **Localization Support**: Multi-language notification support
- **Testing Helpers**: Sandbox assertions for easy testing

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

[](#installation)

### Step 1: Install the Package

[](#step-1-install-the-package)

```
composer require softlandtech/notify
```

### Step 2: Publish Configuration

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

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

### Step 3: (Optional) Publish Migrations

[](#step-3-optional-publish-migrations)

If you want to use notification history:

```
php artisan vendor:publish --tag=notify-migrations
php artisan migrate
```

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

[](#configuration)

The package is configured via `config/notify.php` and environment variables.

### Environment Variables

[](#environment-variables)

```
# Notification Strategy
NOTIFICATION_STRATEGY=all  # or 'round_robin'

# Channels to use (comma-separated)
NOTIFICATION_CHANNELS=mail,sms,whatsapp

# Channel Order
NOTIFICATION_CHANNEL_ORDER=mail,sms,whatsapp

# Sandbox Mode
NOTIFICATION_SANDBOX=false

# Retry Configuration
NOTIFICATION_RETRY_ENABLED=false
NOTIFICATION_RETRY_ATTEMPTS=3
NOTIFICATION_RETRY_BACKOFF=exponential  # or 'linear'
NOTIFICATION_RETRY_DELAY=1000

# Rate Limiting
NOTIFICATION_RATE_LIMIT_ENABLED=true
NOTIFICATION_RATE_LIMIT_MAX=5
NOTIFICATION_RATE_LIMIT_DECAY=1

# Notification History
NOTIFICATION_HISTORY_ENABLED=false
NOTIFICATION_HISTORY_PRUNE_DAYS=30

# User Preferences
NOTIFICATION_USER_PREFERENCES_ENABLED=false

# Events
NOTIFICATION_EVENTS_ENABLED=true

# Taqnyat SMS
TAQNYAT_BASE_URL=https://api.taqnyat.sa
TAQNYAT_TOKEN=your-token
TAQNYAT_SENDER=your-sender

# WhatsApp
WHATSAPP_API_VERSION=v22.0
WHATSAPP_PHONE_NUMBER_ID=your-phone-number-id
WHATSAPP_TOKEN=your-access-token
WHATSAPP_TEMPLATE_NAME=your-default-template
WHATSAPP_TEMPLATE_LANGUAGE=en_US
WHATSAPP_DEFAULT_LANGUAGE=ar

# WhatsApp Templates
WHATSAPP_TEMPLATE_OTP=otp_template
WHATSAPP_TEMPLATE_VERIFICATION=verification_template
WHATSAPP_TEMPLATE_PASSWORD_RESET=password_reset_template
```

Also configure channels in `config/notifications.php`:

```
'channels' => array_filter(array_map('trim', explode(',', env('NOTIFICATION_CHANNELS', 'mail')))),

'channel_mapping' => [
    'mail' => \SoftLandTech\Notify\Channels\MailChannel::class,
    'sms' => \SoftLandTech\Notify\Channels\TaqnyatChannel::class,
    'whatsapp' => \SoftLandTech\Notify\Channels\WhatsappChannel::class,
],
```

Usage
-----

[](#usage)

### Basic Notification

[](#basic-notification)

Create a notification that extends the package's base class:

```
