M-Pesa payment notification helpers for Laravel — built on felixmuhoro/laravel-mpesa
# felixmuhoro/laravel-mpesa-notify
Multi-channel notifications for M-Pesa payment events in Laravel 10/11/12/13.
Listens to events from `felixmuhoro/laravel-mpesa` and fans them out to **mail**, **SMS via Africa's Talking**, **Slack**, and the **database** — fully configurable per event type.
---
## Requirements
| Requirement | Version |
|---|---|
| PHP | ^8.1 |
| Laravel | 10, 11, 12, or 13 |
| felixmuhoro/laravel-mpesa | ^1.2 |
---
## Installation
```bash
composer require felixmuhoro/laravel-mpesa-notify
```
Publish the config file:
```bash
php artisan vendor:publish --tag=mpesa-notify-config
```
Optionally publish migrations and views:
```bash
php artisan vendor:publish --tag=mpesa-notify-migrations
php artisan vendor:publish --tag=mpesa-notify-views
php artisan migrate
```
---
## Configuration
Add the following variables to your `.env`:
```env
# Channels to enable globally (comma-separated)
# Supported: mail, mpesa-sms, slack, database
MPESA_NOTIFY_CHANNELS=mail,mpesa-sms,database
# Africa's Talking credentials (required for mpesa-sms channel)
AT_API_KEY=your_africas_talking_api_key
AT_USERNAME=your_username
AT_SENDER_ID=MPESA
AT_SANDBOX=false
# Slack incoming webhook (required for slack channel)
MPESA_NOTIFY_SLACK_WEBHOOK=
hooks.slack.com...
# Optional: auto-resolve the notifiable by phone from your User model
MPESA_NOTIFY_USER_MODEL=App\Models\User
MPESA_NOTIFY_PHONE_COLUMN=phone_number
# Set to false to register event listeners manually
MPESA_NOTIFY_AUTO_LISTEN=true
```
Full config reference: `config/mpesa-notify.php`.
---
## Channels
| Channel | Identifier | Driver |
|---|---|---|
| Email | `mail` | Laravel built-in mailer |
| SMS | `mpesa-sms` | Africa's Talking REST API |
| Slack | `slack` | Laravel Slack notification |
| Database | `database` | Laravel `notifications` table |
### Per-event channel override
```php
// config/mpesa-notify.php
'channels_per_event' => [
'payment_successful' => ['mail', 'mpesa-sms', 's …