ayles-software/laravel-sms-messagemedia

ClickSend Notifications channel for Laravel 10
1,165 1
Install
composer require ayles-software/laravel-sms-messagemedia
Latest Version:2.3.0
PHP:^8.3
License:MIT
Last Updated:Sep 16, 2025
Links: GitHub  ·  Packagist
Maintainer: parkourben99

MessageMedia sms notifications channel for Laravel 10

This package makes it easy to send notifications using messagemedia.com with Laravel 10.

Installation

Install the package via composer:

composer require ayles-software/laravel-sms-messagemedia

When generating an API key in Message Media make sure to use the Basic Authentication type. HMAC Auth is not supported

Add your MessageMedia api key, secret and optional default sender sms_from to your config/services.php:

'message_media' => [
    'key' => env('MESSAGE_MEDIA_KEY'),
    'secret'  => env('MESSAGE_MEDIA_SECRET'),
    'from' => env('MESSAGE_MEDIA_FROM'),
],

Usage

Use MessageMediaChannel in via() method inside your notification classes. Example:

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use AylesSoftware\MessageMedia\MessageMediaChannel;
use AylesSoftware\MessageMedia\MessageMediaMessage;

class SmsTest extends Notification
{
    public function __construct(public string $token)
    {
    }

    public function via($notifiable)
    {
        return [MessageMediaChannel::class];
    }

    public function toMessageMedia($notifiable)
    {
        return (new MessageMediaMessage)
            ->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")
            ->from('Dory');
            
        // setting a delay when the sms should be sent
        return (new MessageMediaMessage)
            ->message("SMS test to user #{$notifiable->id} with token {$this->token} by MessageMedia")
            ->from('Dory')
            ->delay(now()->addHours(6));
    }
}

In notifiable model (User), include method routeNotificationForMessageMedia() that returns recipient mobile number:

public function routeNotificationForMessageMedia()
{
    return $this->phone;
}

Then send a notification the standard way:

$user = User::find(1);

$user->notify(new SmsTest);

Events

Following events are triggered by Notification. By default:

  • Illuminate\Notifications\Events\NotificationSending
  • Illuminate\Notifications\Events\NotificationSent

NotificationFailed will trigger if something goes wrong

  • Illuminate\Notifications\Events\NotificationFailed

Testing

Yes

License

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

Related Packages

koomai/laravel-twilio-sms

Twilio SMS driver for Laravel Notifications

24 0
cca-bheath/laravel-sms-clicksend

ClickSend Notifications channel for Laravel 5.8+

11,308 1
skovachev/notifier

Laravel 4 package for sending SMS and email notifications

25 8
superloop-ltd/laravel-sms-clicksend

ClickSend Notifications channel for Laravel 5.1+

10,788 1