pippa/notification-sdk-curl

Notification Service SDK for plain PHP — zero dependencies, pure cURL

Maintainers

Package info

github.com/rajoni-pippa/pippa-notification-service-curl-sdk

pkg:composer/pippa/notification-sdk-curl

Transparency log

Statistics

Installs: 17

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.9 2026-06-22 04:41 UTC

This package is auto-updated.

Last update: 2026-07-22 04:53:38 UTC


README

Pure PHP SDK for the Notification Service API.
Zero dependencies — works in any PHP 8.1+ environment without Laravel or Guzzle.

Installation

composer require pippa/notification-sdk-curl

Setup

<?php
require 'vendor/autoload.php';

use Pippa\NotificationSdkCurl\NotificationClient;

$client = new NotificationClient(
    apiKey:    'your_api_key',
    secretKey: 'your_secret_key',
);

Usage

Send Email

$response = $client->sendEmail(
    email:    'user@example.com',
    template: 'welcome_email',
    data:     ['name' => 'Rahim']
);

Send SMS

$response = $client->sendSms(
    phone:    '+8801700000000',
    template: 'otp_sms',
    data:     ['otp' => '1234']
);

Send WhatsApp

$response = $client->sendWhatsapp(
    whatsapp: '+8801700000000',
    template: 'whatsapp_template',
    data:     ['name' => 'Rahim']
);

Send Push Notification

$response = $client->sendPush(
    push:     'device_token_or_user_id',
    template: 'push_template',
    data:     ['title' => 'Hello!', 'body' => 'You have a new message.']
);

Send In-App Notification

$response = $client->sendInApp(
    userId:   'user_123',
    template: 'order_update',
    data:     ['order_id' => 'ORD-456', 'status' => 'Shipped']
);

Send Slack

$response = $client->sendSlack(
    slack:    '#general',
    template: 'slack_alert',
    data:     ['message' => 'Deployment successful!']
);

Send Discord

$response = $client->sendDiscord(
    discord:  'channel_id_or_webhook',
    template: 'discord_alert',
    data:     ['message' => 'New order received!']
);

Multi-channel (Courier-style)

use Pippa\NotificationSdkCurl\Requests\SendMessageRequest;
use Pippa\NotificationSdkCurl\DTOs\TemplateMessage;
use Pippa\NotificationSdkCurl\DTOs\Recipient;

$response = $client->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'],
        ]),
    ])
);

if ($response->isSuccess()) {
    echo 'Sent! ID: ' . $response->getRequestId();
}

Exception Handling

use Pippa\NotificationSdkCurl\Exceptions\NotificationException;

try {
    $client->sendEmail('user@example.com', 'my_template');
} catch (NotificationException $e) {
    echo $e->getMessage();    // error message
    echo $e->getCode();       // HTTP status code
    print_r($e->getErrors()); // validation errors array
}

Available Methods

Method Description
send(SendMessageRequest) Full control
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\NotificationSdkCurl\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