Looking to hire Laravel developers? Try LaraJobs

ultrasms-laravel-notification maintained by shiroamada

Description
UltraSms Notifications channel for Laravel 11 and Above
Author
Last update
2025/08/06 10:19 (dev-main)
License
Downloads
203

Comments
comments powered by Disqus

UltraSms notifications channel for Laravel 11+

Latest Version on Packagist Software License Build Status StyleCI Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using https://ultramsg.com/ with Laravel 11+.

Code Reference from laravel-notification-channels/smsc-ru

Contents

Installation

You can install the package via composer:

composer require shiroamada/ultrasms-laravel-notification

Then you must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\UltraSms\UltraSmsServiceProvider::class,
],

Setting up the UltraSMS service

Add your ultrasms instanceId and token to your config/services.php:

// config/services.php
...
'ultrasms' => [
    'isEnable' => env('ULTRASMS_ENABLE') ?? 0,
    'instanceId' => env('ULTRASMS_INSTANCEID'),
    'token' => env('ULTRASMS_TOKEN'),
    'isMalaysiaMode' => env('ULTRASMS_MALAYSIA_MODE') ?? 0,
    'isEnable' => env('ULTRASMS_ENABLE') ?? 0,
    'isDebug' => env('ULTRASMS_DEBUG_ENABLE') ?? 0,
    'debugReceiveNumber' => env('ULTRASMS_DEBUG_RECEIVE_NUMBER'),
],
...

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\UltraSms\UltraSmsMessage;
use NotificationChannels\UltraSms\UltraSmsChannel;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [UltraSmsChannel::class];
    }

    public function toUltraSms($notifiable)
    {
        return UltraSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForUltraSms() method, which return the phone number.

public function routeNotificationForUltraSms()
{
    return $this->mobile; //depend what is your db field
}

Available methods

content(): Set a content of the notification message.

sendAt(): Set a time for scheduling the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please use the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.