laravel-smsmapi-notifications maintained by cyberwolfstudio
Description
SmsAPI Notifications Channel for Laravel
Author
Last update
2026/02/19 16:04
(dev-main)
License
Downloads
3
SmsAPI Notifications Channel for Laravel
Laravel notification channel for sending SMS via SmsAPI. Supports both Polish (smsapi.pl) and international (smsapi.com) services.
Compatible with Laravel 6.x through 12.x.
Installation
composer require cyberwolfstudio/laravel-smsmapi-notifications
The service provider is auto-discovered. No manual registration needed.
Configuration
Add your SmsAPI token to config/services.php:
'smsapi' => [
'token' => env('SMSAPI_AUTH_TOKEN'),
],
Optionally set the service region in config/smsapi.php:
// 'pl' (default) or 'com'
'service' => env('SMSAPI_SERVICE', 'pl'),
Usage
Implement the SmsAPINotification contract on your notification and return an SmsAPIMessage:
use Illuminate\Notifications\Notification;
use CyberWolfStudio\LaravelSmsAPINotifications\SmsAPIPlChannel;
use CyberWolfStudio\LaravelSmsAPINotifications\SmsAPIMessage;
use CyberWolfStudio\LaravelSmsAPINotifications\Contracts\SmsAPINotification;
class OrderShipped extends Notification implements SmsAPINotification
{
public function via($notifiable): array
{
return [SmsAPIPlChannel::class];
}
public function toSmsAPI($notifiable): SmsAPIMessage
{
return new SmsAPIMessage('Your order has been shipped!');
}
}
Routing
Add a routeNotificationForSmsapi method to your notifiable model to return the phone number:
public function routeNotificationForSmsapi(): string
{
return $this->phone_number;
}
To send to a contacts group instead, add routeNotificationForSmsapiGroup:
public function routeNotificationForSmsapiGroup(): string
{
return $this->contacts_group;
}
License
The MIT License (MIT). Please see License File for more information.