SMS Channel
The sms channel sends SMS text messages through native zero-dependency pure-PHP cURL drivers.
The SmsMessage Builder
Define a toSms() method returning Jengo\Notifications\Messages\SmsMessage:
php
namespace App\Notifications;
use Jengo\Notifications\Messages\SmsMessage;
use Jengo\Notifications\Notification;
class SecurityAlert extends Notification
{
public function via(object $notifiable): array
{
return ['sms'];
}
public function toSms(object $notifiable): SmsMessage
{
return (new SmsMessage('A new login was detected on your account.'))
->link(site_url('security/activity'), 'Review');
}
}Supported Drivers
Configure your preferred driver in app/Config/Notifications.php:
php
public string $defaultSmsDriver = 'sms_gate'; // 'sms_gate', 'africas_talking', 'twilio', 'log', 'null'1. SMSGate (SMS Gateway for Android™)
The sms_gate driver turns any Android smartphone into a cost-effective SMS gateway using the SMS Gateway for Android™ app.
Configuration
php
public array $smsGate = [
// Local device/emulator or Cloud relay (https://api.sms-gate.app/3rdparty/v1)
'serverUrl' => 'http://localhost:8080',
'login' => 'admin',
'password' => 'secret',
'token' => '', // Bearer/Server-Key token (takes precedence over login/password)
'simNumber' => 1, // Optional SIM slot (1, 2, or 3)
'deviceId' => null,
'priority' => 100, // Priority (-128 to 127; > 99 bypasses rate limits)
'withDeliveryReport' => true,
'defaultCountryCode' => '+254',
'timeout' => 15,
];Local Android Testing
- Install SMS Gateway for Android™ on a phone or Android Studio emulator.
- In the app settings, enable HTTP Server.
- If running on an Android Studio emulator, connect via
http://10.0.2.2:8080. - If running on a physical phone connected to the same Wi-Fi network, specify its local IP (e.g.
http://192.168.1.100:8080).
2. Africa's Talking
High-throughput SMS delivery across Africa (Kenya, Nigeria, Uganda, Tanzania, Rwanda, Ghana, South Africa, and more).
Configuration
php
public array $africasTalking = [
'username' => 'sandbox', // or production username
'apiKey' => 'your-api-key',
'senderId' => 'ACME', // Approved alphanumeric sender ID
'defaultCountryCode' => '+254',
];The driver automatically normalizes phone numbers (e.g. 0712345678 is automatically converted to +254712345678 using defaultCountryCode).
3. Twilio
Global SMS delivery using Twilio's Programmable Messaging API.
Configuration
php
public array $twilio = [
'accountSid' => 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'authToken' => 'your_auth_token',
'fromNumber' => '+1234567890',
];4. Local Testing (log & null)
log: Writes SMS recipient and message text directly towritable/logs/log-YYYY-MM-DD.log.null: Silently discards outbound messages without network requests.
