alitvinov/laravel-mobizon

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Mobizon SMS notifications driver for Laravel

v1.05 2020-04-30 15:53 UTC

This package is not auto-updated.

Last update: 2021-10-07 23:45:05 UTC


README

Installation

Install via composer:

composer require Alitvinov/LaravelMobizon

Setting up your Mobizon service

Add your Mobizon credentials to config/services.php – a common file to store third-party service credentials.

// config/services.php
...
'mobizon' => [
    'domain' => '', 
    'secret' => '',
    'alphaname' => null,
],

Usage

The package provides a new channel that can be used in your notification class like the following:

use Illuminate\Notifications\Notification;
use Alitvinov\LaravelMobizon\MobizonChannel;
use Alitvinov\LaravelMobizon\MobizonMessage;

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

public function toMobizon($notifiable)
{
    return MobizonMessage::create("Your SMS message");
}

Add a routeNotificationForMobizon method to your Notifiable model to return the phone number:

public function routeNotificationForMobizon()
{
    //Phone number without symbols or spaces
    return $this->phone_number;
}

Credits

Thanks to laraketai for the original package.

License

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