pippa / notification-sdk-laravel
Notification Service SDK for Laravel — Guzzle, ServiceProvider, Facade
Package info
github.com/rajoni-pippa/pippa-notification-service-laravel-sdk
pkg:composer/pippa/notification-sdk-laravel
v1.1.4
2026-06-22 05:24 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/contracts: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
README
Laravel SDK for the Notification Service API.
Requires Guzzle — includes ServiceProvider, Facade, and DI support.
Installation
composer require pippa/notification-sdk-laravel
Laravel will auto-discover the service provider and facade.
Configuration
Publish config:
php artisan vendor:publish --tag=notification-config
Add to .env:
NOTIFICATION_API_KEY=your_api_key NOTIFICATION_SECRET_KEY=your_secret_key
Usage — Facade
use Pippa\NotificationSdkLaravel\Facades\NotificationService; // Send Email $response = NotificationService::sendEmail( email: 'user@example.com', template: 'welcome_email', data: ['name' => 'Rahim'] ); // Send SMS $response = NotificationService::sendSms( phone: '+8801700000000', template: 'otp_sms', data: ['otp' => '1234'] ); // Send WhatsApp $response = NotificationService::sendWhatsapp( whatsapp: '+8801700000000', template: 'whatsapp_template', data: ['name' => 'Rahim'] ); // Send Push Notification $response = NotificationService::sendPush( push: 'device_token_or_user_id', template: 'push_template', data: ['title' => 'Hello!', 'body' => 'You have a new message.'] ); // Send In-App $response = NotificationService::sendInApp( userId: 'user_123', template: 'order_update', data: ['order_id' => 'ORD-456', 'status' => 'Shipped'] ); // Send Slack $response = NotificationService::sendSlack( slack: '#general', template: 'slack_alert', data: ['message' => 'Deployment successful!'] ); // Send Discord $response = NotificationService::sendDiscord( discord: 'channel_id_or_webhook', template: 'discord_alert', data: ['message' => 'New order received!'] );
Multi-channel (Courier-style)
use Pippa\NotificationSdkLaravel\Facades\NotificationService; use Pippa\NotificationSdkLaravel\Requests\SendMessageRequest; use Pippa\NotificationSdkLaravel\DTOs\TemplateMessage; use Pippa\NotificationSdkLaravel\DTOs\Recipient; $response = NotificationService::send( new SendMessageRequest([ 'message' => new TemplateMessage([ 'to' => [ Recipient::email('user@example.com'), Recipient::phone('+8801700000000'), Recipient::userId('user_123'), Recipient::whatsapp('+8801747436390'), Recipient::push('device_token'), Recipient::slack('#general'), Recipient::discord('channel_id'), ], 'template' => 'welcome_notification', 'data' => ['name' => 'Rahim'], ]), ]) ); echo $response->getRequestId();
Restrict a recipient to specific channels
Recipient::make([ 'email' => 'user@example.com', 'phone' => '+8801700000000', 'user_id' => 'user_123', ])->only(['email', 'sms'])
Usage — Dependency Injection
use Pippa\NotificationSdkLaravel\NotificationClient; class OrderService { public function __construct(protected NotificationClient $notification) {} public function notifyShipped(string $email, string $orderId): void { $this->notification->sendEmail( email: $email, template: 'order_shipped', data: ['order_id' => $orderId] ); } }
Exception Handling
use Pippa\NotificationSdkLaravel\Exceptions\NotificationException; try { NotificationService::sendEmail('user@example.com', 'my_template'); } catch (NotificationException $e) { $e->getMessage(); $e->getCode(); $e->getErrors(); }
Available Methods
| Method | Description |
|---|---|
send(SendMessageRequest) |
Full control over the request |
sendEmail($email, $template, $data) |
Send email via template |
sendSms($phone, $template, $data) |
Send SMS via template |
sendWhatsapp($whatsapp, $template, $data) |
Send WhatsApp message |
sendPush($push, $template, $data) |
Send push notification |
sendInApp($userId, $template, $data) |
Send in-app notification |
sendSlack($slack, $template, $data) |
Send Slack message |
sendDiscord($discord, $template, $data) |
Send Discord message |
sendMulti($recipients[], $template, $data) |
Multi-channel, multi-recipient |
Recipient Helpers
use Pippa\NotificationSdkLaravel\DTOs\Recipient; Recipient::email('user@example.com') Recipient::phone('+8801700000000') Recipient::userId('user_123') Recipient::whatsapp('+8801700000000') Recipient::push('device_token') Recipient::slack('#general') Recipient::discord('channel_id') Recipient::make(['email' => '...', 'phone' => '...', 'user_id' => '...']) Recipient::make([...])->only(['email', 'sms'])
License
MIT