PHPackages                             pahappa-limited/comms-sdk - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. pahappa-limited/comms-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

pahappa-limited/comms-sdk
=========================

This is the PHP version of the Comms SDK - which will help PHP software to communicate with the Communications platform bulk messaging servce by Pahappa Limited

07PHP

Since Dec 18Pushed 4mo agoCompare

[ Source](https://github.com/Pahappa-LTD/comms-php-sdk)[ Packagist](https://packagist.org/packages/pahappa-limited/comms-sdk)[ RSS](/packages/pahappa-limited-comms-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

CommsSDK PHP SDK
================

[](#commssdk-php-sdk)

A PHP implementation of the CommsSDK for sending SMS and managing communications, following the same patterns as the Python, Ruby, and other language reference implementations.

**Version:** 1.0.1

---

Features
--------

[](#features)

- Consistent API across all supported languages
- Authenticate with username and API key
- Send SMS to one or more recipients
- Optional sender ID and message priority
- Check account balance
- Comprehensive error handling

---

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

[](#installation)

Install via Composer:

```
composer require pahappa/comms-sdk
```

Or add to your `composer.json`:

```
{
  "require": {
    "pahappa/comms-sdk": "1.0.1"
  }
}
```

---

Usage
-----

[](#usage)

### Basic Authentication

[](#basic-authentication)

```
require_once 'vendor/autoload.php';

use CommsSDK\V1\CommsSDK;

// Authenticate with your username and API key
$sdk = CommsSDK::authenticate('your_username', 'your_api_key');
```

### Sending SMS

[](#sending-sms)

```
// Send SMS to a single number
$success = $sdk->sendSMS('256712345678', 'Hello from PHP!');

// Send SMS to multiple numbers
$success = $sdk->sendSMS(['256712345678', '256787654321'], 'Hello to all!');

// Send SMS with custom sender ID and priority
$success = $sdk->sendSMS(
    ['256712345678'],
    'Hello!',
    'MyApp',
    MessagePriority::HIGH
);

// Get full API response
$response = $sdk->querySendSMS(
    ['256712345678'],
    'Hello!',
    'MyApp',
    MessagePriority::HIGHEST
);
```

### Checking Balance

[](#checking-balance)

```
// Get balance as a float
$balance = $sdk->getBalance();
echo "Balance: $balance\n";

// Get full balance response
$response = $sdk->queryBalance();
echo "Status: {$response->status}\n";
echo "Balance: {$response->balance}\n";
echo "Currency: {$response->currency}\n";
```

### Configuration

[](#configuration)

```
// Use sandbox environment
CommsSDK::useSandBox();

// Use live server (default)
CommsSDK::useLiveServer();

// Set custom sender ID
$sdk = $sdk->withSenderId('MyCustomSender');
```

---

API Reference
-------------

[](#api-reference)

### CommsSDK

[](#commssdk)

#### Static Methods

[](#static-methods)

- `CommsSDK::authenticate($userName, $apiKey): CommsSDK`
    - Authenticate and return SDK instance.
- `CommsSDK::useSandBox()`
    - Switch to sandbox environment.
- `CommsSDK::useLiveServer()`
    - Switch to live environment.

#### Instance Methods

[](#instance-methods)

- `withSenderId($senderId): CommsSDK`
    - Set sender ID, returns self for chaining.
- `sendSMS($numbers, $message, $senderId = null, $priority = MessagePriority::HIGHEST): bool`
    - Send SMS, returns boolean.
- `querySendSMS($numbers, $message, $senderId, $priority): ?ApiResponse`
    - Send SMS, returns full ApiResponse.
- `getBalance(): ?float`
    - Get account balance as float.
- `queryBalance(): ?ApiResponse`
    - Get full balance response as ApiResponse.
- `isAuthenticated(): bool`
    - Returns authentication status.
- `getApiKey()`
    - The API key used for authentication.
- `getUserName()`
    - The username used for authentication.
- `getSenderId()`
    - Current sender ID.

### Models

[](#models)

#### MessagePriority

[](#messagepriority)

- `MessagePriority::HIGHEST` - Priority "0"
- `MessagePriority::HIGH` - Priority "1"
- `MessagePriority::MEDIUM` - Priority "2"
- `MessagePriority::LOW` - Priority "3"
- `MessagePriority::LOWEST` - Priority "4"

#### ApiResponse

[](#apiresponse)

- `status` - Response status ("OK" or "Failed")
- `message` - Response message
- `cost` - Message cost
- `currency` - Currency code
- `msgFollowUpUniqueCode` - Unique tracking code
- `balance` - Account balance

---

Error Handling
--------------

[](#error-handling)

The SDK throws exceptions for authentication and validation errors:

```
try {
    $sdk = CommsSDK::authenticate('', ''); // Empty credentials
} catch (InvalidArgumentException $e) {
    echo "Authentication error: " . $e->getMessage();
}

try {
    $sdk->sendSMS([], ''); // Empty numbers and message
} catch (InvalidArgumentException $e) {
    echo "Validation error: " . $e->getMessage();
}
```

---

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on GitHub.

---

License
-------

[](#license)

The SDK is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance53

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c5b7062d87c04a0e62fdee79892f0de5e08cfc77424d0bfb724d6847cabbacd1?d=identicon)[pahappalimited](/maintainers/pahappalimited)

---

Top Contributors

[![StrongTheDev](https://avatars.githubusercontent.com/u/33962088?v=4)](https://github.com/StrongTheDev "StrongTheDev (6 commits)")

### Embed Badge

![Health badge](/badges/pahappa-limited-comms-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/pahappa-limited-comms-sdk/health.svg)](https://phpackages.com/packages/pahappa-limited-comms-sdk)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M316](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
