webmobyle/africastalking-sms

Africa's Talking SMS integration with logging & DLRs for Laravel.

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

pkg:composer/webmobyle/africastalking-sms

1.0.3 2025-12-12 13:07 UTC

This package is auto-updated.

Last update: 2026-01-12 13:17:50 UTC


README

Packagist Version License Laravel

Africa's Talking SMS integration with logging & DLRs for Laravel.

🚀 Features

  • Queue-based SMS sending
  • Delivery report (DLR) handling
  • SMS log storage
  • Optional UI for logs and test sends
  • Logs CSV export
  • Test Send UI screen with sandbox support.
  • Publishable views, config, and migrations
  • Laravel 10/11/12 support

See CHANGELOG.md for release history.

📦 Installation

Install via Composer:

composer require webmobyle/africastalking-sms

Publish assets:

php artisan vendor:publish --provider="Webmobyle\AfricasTalkingSms\AfricasTalkingSmsServiceProvider" --tag=africastalking-sms-config

php artisan vendor:publish --provider="Webmobyle\AfricasTalkingSms\AfricasTalkingSmsServiceProvider" --tag=africastalking-sms-migrations

php artisan vendor:publish --provider="Webmobyle\AfricasTalkingSms\AfricasTalkingSmsServiceProvider" --tag=africastalking-sms-views

Run migrations:

php artisan migrate

⚙️ Configuration

Add these keys to your .env:

QUEUE_CONNECTION=database

AFRICASTALKING_USERNAME=sandbox
AFRICASTALKING_API_KEY=your_key
AFRICASTALKING_SENDER_ID=
AFRICASTALKING_DLR_SECRET=local-dlr-secret
AFRICASTALKING_SMS_QUEUE=sms

For DLRs, set in Africa’s Talking dashboard: https://your-app-domain.com/api/sms/dlr?secret=local-dlr-secret

…and the package controller will handle the rest.

👷 Queue Worker

php artisan queue:work --queue=sms,default

🧩 How It Works

SMS Sending

You can send SMS from your app as follows

use Webmobyle\AfricasTalkingSms\SmsSender;

public function test(SmsSender $sms)
{
    $sms->queue('+265991234567', 'Hello from the package');
}

or

app(\Webmobyle\AfricasTalkingSms\SmsSender::class)
    ->queue('+265991234567', 'Another test');

IMPORTANT: Numbers should folow the International E.164 Format. Example: +265991234567. Malawi local formats (e.g. 0991234567) are automatically converted to international format.

📁 Model: SmsMessage

This model conects to a `mysqldatabase connection by default. To modify this behaviour add the following configuration key in theconfig/database.php` file.

'paychangu_connection' => env('AFRICASTALKING_SMS_DB_CONNECTION', 'mysql'),

📃 SMS Logs & 💬 Test Send UI (Both Optional)

By default you’ll have:

Logs: /sms-logs | Route name: sms-logs.index

Test send: /sms-logs/test | Route name: sms-logs.test

Middleware: web, auth

You may customize in the package configuration files as well as in published views.

🧱 Requirements

DependencyVersion
PHP^8.2
Laravel10.x – 12.x
Africa’s Talking PHP SDK (africastalking/africastalking)^3.0

📦 Versioning

This package follows Semantic Versioning (SemVer) — tag releases like v1.0.0, v1.1.0, etc.

🪪 License

This package is open-sourced software licensed under the MIT License.

👤 Author

Barnett Temwa Msiska
Founder, Webmobyle Limited
📧 barnett@webmobyle.com

⭐ Support

If you find this package useful, please star it on Packagist or Bitbucket.
Contributions, pull requests, and issues are welcome!

Email: contact@webmobyle.com