jengo / notifications
Multi-channel notification delivery engine for CodeIgniter 4 and the Jengo Framework (Email, SMS, Database, Push, Webhooks, Slack, Broadcast).
Requires
- php: ^8.2
- codeigniter4/framework: ^4.7
- codeigniter4/queue: ^1.0
- jengo/base: ^1.1
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
- africastalking/africastalking: Alternative vendor SDK for Africa's Talking (native pure-PHP cURL driver is used by default)
- jengo/broadcasting: Required when broadcasting notifications in real-time over SSE or WebSockets
- twilio/sdk: Alternative vendor SDK for Twilio (native pure-PHP cURL driver is used by default)
Provides
None
Conflicts
None
Replaces
None
README
Jengo Notifications
A unified multi-channel notifications engine for CodeIgniter 4 and the Jengo Framework. Seamlessly delivers across Mail, SMS, In-App Database, Push, Webhooks, Slack, and Real-Time Broadcasts.
Documentation • License • Issues
Installation
composer require jengo/notifications php spark jengo:install notifications
Quick Start
1. Define the Notification
namespace App\Notifications; use Jengo\Notifications\Messages\MailMessage; use Jengo\Notifications\Notification; class InvoicePaid extends Notification { public function __construct(public array $invoice) { parent::__construct(); } public function via(object $notifiable): array { return ['mail', 'database', 'sms']; } public function toMail(object $notifiable): MailMessage { return (new MailMessage()) ->subject("Invoice Paid #{$this->invoice['id']}") ->line("We have received your payment of \${$this->invoice['amount']}.") ->action('View Receipt', site_url("invoices/{$this->invoice['id']}")); } }
2. Dispatch Notifications
use App\Notifications\InvoicePaid; use Jengo\Notifications\Notification; // Dispatch directly via any Notifiable entity $user->notify(new InvoicePaid($invoice)); // Dispatch to multiple recipients Notification::send([$admin, $customer], new InvoicePaid($invoice)); // On-demand notification to ad-hoc recipients Notification::route('mail', 'billing@example.com') ->route('sms', '+254712345678') ->notify(new InvoicePaid($invoice));
Documentation
For comprehensive guides on all delivery channels (Mail, SMS Gate, Africa's Talking, Twilio, WebPush, FCM, Slack, Webhooks), queue integration via ShouldQueue, in-app notifications management, and Notification::fake() testing doubles, visit https://lipex-org.github.io/jengophp.com/packages/notifications.
License
Released under the MIT License.