mg-techlegend/laravel-beem-africa

A Laravel package to send SMS using Beem Africa via Laravel notifications

1.2.0 2025-05-28 23:54 UTC

This package is auto-updated.

Last update: 2025-06-18 07:56:56 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package to send SMS via Beem Africa using Laravel Notifications.

This package provides a simple, elegant way to send SMS messages using Beem Africa's API. It integrates seamlessly with Laravel's native notification system, allowing you to send SMS just like Mail or Slack notifications. Currently, the package supports SMS functionality, with more Beem services (such as OTPs, voice, USSD, and messaging insights) to be added soon.

๐Ÿ“ฆ Installation

You can install the package via Composer:

composer require mg-techlegend/laravel-beem-africa

Then, publish the config file:

php artisan vendor:publish --tag="laravel-beem-africa-config"

Update your .env file with your Beem credentials:

BEEM_API_KEY=your-api-key
BEEM_SECRET_KEY=your-secret
BEEM_SENDER_NAME=your-sender-name

๐Ÿ›  Configuration

The config file config/beem.php will contain:

return [
    'api_key' => env('BEEM_API_KEY'),
    'secret_key' => env('BEEM_SECRET_KEY'),
    'sender_name' => env('BEEM_SENDER_NAME'),
];

๐Ÿš€ Usage

You can send SMS via Laravelโ€™s notification system like this:

Create a notification:

use Illuminate\Notifications\Notification;
use TechLegend\LaravelBeemAfrica\SMS\BeemMessage;

class SendSmsNotification extends Notification
{
    public function via($notifiable): array
    {
        return ['beem'];
    }

    public function toBeem($notifiable): BeemMessage
    {
        return new BeemMessage('Your order has been shipped!');
    }
}

Use in your model:

Make sure your Notifiable model has a routeNotificationForBeem() method that returns the recipientโ€™s phone number in array.

public function routeNotificationForBeem(): array
{
    return array($this->phone_number);
}

Send the notification:

$user->notify(new SendSmsNotification());

โœ… Testing

composer test

Tests are written using Pest and run automatically via GitHub Actions on every push.

โ› Roadmap

  • SMS Notifications
  • OTP Support
  • USSD Integration
  • Message Insights
  • Webhooks Support
  • Voice Notifications

๐Ÿ“„ Changelog

Please see CHANGELOG for more information on what has changed recently.

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

๐Ÿ”’ Security

If you discover any security issues, please review our security policy to report them.

๐Ÿ‘จโ€๐Ÿ’ป Credits

๐Ÿ“œ License

The MIT License (MIT). Please see the LICENSE file for more information.