Vanilla PHP SDK for SignalBridge SMS Gateway - Send SMS messages through multiple vendors (SpeedaMobile, Africa's Talking) with a unified API. Works with any PHP project (no framework required).
# SignalBridge PHP SDK
Vanilla PHP SDK for SignalBridge SMS Gateway - Send SMS messages through multiple vendors (SpeedaMobile, Africa's Talking) with a unified API. Works with any PHP project (no framework required).
## Features
- **Framework Agnostic** - Works with any PHP project
- **Simple API** - Clean, intuitive interface
- **Batch SMS** - Send up to 100 messages in a single request
- **Balance Management** - Check balance, view transactions, get usage reports
- **Scheduled Messages** - Schedule SMS for future delivery
- **Segment Calculation** - Automatic cost estimation (GSM 7-bit vs Unicode)
- **Custom Exceptions** - Typed exceptions for better error handling
- **PHP 7.4+** - Compatible with modern PHP versions
- **Composer Ready** - Easy installation via Composer
## Requirements
- PHP 7.4 or higher
- Guzzle HTTP 7.0+
- Composer
## Installation
Install via Composer:
```bash
composer require nugsoft/signalbridge-php-sdk
```
## Quick Start
```php
sendSms(
recipient: '256700000000',
message: 'Hello from PHP!',
options: [
'metadata' => ['user_id' => 123]
]
);
echo "Message sent! ID: {$result['data']['message_id']}\n";
```
## Getting Your API Token
Contact your system administrator or generate a token via cURL:
```bash
curl -X POST
signal-bridge.nugsoftstaggi… \
-H "Content-Type: application/json" \
-d '{
"email": "your-product@nugsoft.com",
"password": "your-password",
"expires_in_days": 365
}'
```
## Usage Examples
### 1. Send Simple SMS
```php
sendSms(
recipient: '256700000000',
message: 'Your verification code is 123456',
options: [
'metadata' => [
'action' => 'otp_verification',
'user_id' => 789
]
]
);
echo "Message sent successfully!\n";
echo "Cost: {$result['data']['cost']} UGX\n";
} catch (InsufficientBalanceException $e) {
echo "Insufficient balance\n";
echo "Required: {$e->getRequiredBalance()}\n";
echo "Available: {$e->getCurrentBalance()}\n";
}
```
### 2. Send Batch SMS
```php
'256700000000', 'name' => …