mrhmh/sms-rahyab

There is no license information available for the latest version (v0.2) of this package.

v0.2 2021-04-29 11:03 UTC

This package is auto-updated.

Last update: 2024-09-17 14:28:06 UTC


README

Latest Version on Packagist Software License

This package makes it easy to send notifications using sms.rahyab.ir.

Installation

Install this package with Composer:

composer require mrhmh/sms-rahyab

Setting up the Rahyab service

Add your Rahyab credential to config/services.php:

// config/services.php
...
'sms_rahyab' => [
        'company'  => env('SMS_RAHYAB_COMPANY'),
        'host'     => env('SMS_RAHYAB_HOST'),
        'port'     => env('SMS_RAHYAB_PORT'),
        'username' => env('SMS_RAHYAB_USERNAME'),
        'password' => env('SMS_RAHYAB_PASSWORD'),
        'sender'   => env('SMS_RAHYAB_SENDER'),
        'token'    => env('SMS_RAHYAB_TOKEN'),
    ],
...

Usage

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

use Illuminate\Notifications\Notification;
use MrHMH\SmsRahyab\SmsRahyabChannel;
use MrHMH\SmsRahyab\SmsRahyabMessage;

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

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

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

public function routeNotificationForSmsrahyab()
{
    return $this->mobile;
}

License

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