novinvision/iranian-laravel-sms

A laravel package for send sms notification with iranian sms providers like ippanel, sms.ir, kavenegar, mellipaymak, ...

v1.0.2 2025-09-23 08:41 UTC

This package is auto-updated.

Last update: 2025-09-23 09:16:57 UTC


README

# Laravel SMS Notification Channel

This package provides a **custom SMS notification channel** for Laravel, built on top of [tzsk/sms](https://github.com/tzsk/sms).

---

## Installation

```bash
composer require novinvision/iranian-laravel-sms
```

Publish the config file

```bash
$ php artisan sms:publish
```

---

## Usage

### Create a Notification

```php
<?php

namespace App\Notifications;

use NovinVision\IranianLaravelSMS\Messages\SmsMessage;
use Illuminate\Notifications\Notification;

class SmsTest extends Notification
{
    public function via($notifiable)
    {
        return ['sms'];
    }

    public function toSms(object $notifiable): SmsMessage
    {
        return (new SmsMessage)
            ->line(sprintf("Dear %s", $notifiable->name))
            ->line("It is Test Sms Message");
    }
}
```

### Add Route to User Model

```php
public function routeNotificationForSms(): ?string
{
    return $this->mobile;
}
```

### Send the Notification

```php
$user->notify(new \App\Notifications\SmsTest());
```

---

## License

MIT