PHPackages                             mortezamasumi/fb-sms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. mortezamasumi/fb-sms

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mortezamasumi/fb-sms
====================

SMS notification channel for Laravel &amp; Filament with pluggable operators (Fake, Sabanovin, Smsir).

v5.1.0(2w ago)02392MITPHPPHP ^8.3CI passing

Since Aug 6Pushed 2w agoCompare

[ Source](https://github.com/mortezamasumi/fb-sms)[ Packagist](https://packagist.org/packages/mortezamasumi/fb-sms)[ Docs](https://github.com/mortezamasumi/fb-sms)[ RSS](/packages/mortezamasumi-fb-sms/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (31)Versions (18)Used By (2)

FB SMS — Laravel SMS Notification Channel
=========================================

[](#fb-sms--laravel-sms-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c54a01b5ae7227a359b4cc532678681220198e9cc4d20bcea3a5260fe0c57595/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7274657a616d6173756d692f66622d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mortezamasumi/fb-sms)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e94619c8ab4bfa7c30e851801627203fd2ea8f335fd949e28d2add5d79055ae2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f7274657a616d6173756d692f66622d736d732f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mortezamasumi/fb-sms/actions?query=branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/61c96e28b2ad27ccefba4133859d6b95e5f428ff0d8b96a7c648fd95e6caaf07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f7274657a616d6173756d692f66622d736d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mortezamasumi/fb-sms)[![License](https://camo.githubusercontent.com/3b2c60c90bbfc6149ce5d11dbfe13b88c451976251be98e4fa2ad749f25582f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f7274657a616d6173756d692f66622d736d732e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A Laravel notification channel that sends SMS through pluggable **operators**. It ships with the `Sabanovin` and `Smsir` (sms.ir) operators, plus a `Fake` operator for local development and testing.

---

Features
--------

[](#features)

- **Drop-in Laravel channel** — send via the standard `Notification::route('sms', ...)->notify(...)` flow
- **Pluggable operators** — swap providers through config without touching your notification classes
- **Built-in operators** — `Sabanovin`, `Smsir`, and a `Fake` logger for local development
- **Prepend/append text** — configure a prefix/suffix (e.g. an opt-out line) applied to every message
- **Recipient fallback** — uses `routeNotificationFor('sms', $notification)`, then `$notifiable->mobile`
- **Lifecycle hooks** — `beforeSend()`, `send()`, `afterSend()`, plus `succeeded()` / `failed()` on notifications
- **Graceful failure** — send/credit errors are caught, logged, and reported to your notification's `failed()`

---

Installation
------------

[](#installation)

```
composer require mortezamasumi/fb-sms
```

Publish the config file:

```
php artisan vendor:publish --tag="fb-sms-config"
```

---

Configuration
-------------

[](#configuration)

```
// config/fb-sms.php
return [
    // Sabanovin API domain (without scheme)
    'sabanovin_domain' => env('SABANOVIN_DOMAIN', 'api.sabanovin.com'),

    // Sabanovin reports the balance in Toman; multiplied to convert to Rial (1 Toman = 10 Rial)
    'sabanovin_balance_multiplier' => env('SABANOVIN_BALANCE_MULTIPLIER', 10),

    // Active operator class — one of the bundled operators or your own
    'operator' => env('SMS_CHANNEL_OPERATOR', \Mortezamasumi\FbSms\Operators\Fake::class),

    // API key/username used by Sabanovin and Smsir
    'api_key' => env('SMS_CHANNEL_API_KEY', 'key'),

    // SMS line/number used as the sender gateway
    'gateway' => env('SMS_CHANNEL_GATEWAY', 'gateway'),

    // Fixed receiver, overrides the notifiable's phone when set
    'receiver' => env('SMS_CHANNEL_RECEIVER', null),

    // Optional prefix/suffix applied to every message
    'prepend_text' => env('SMS_CHANNEL_PREPEND_TEXT', ''),
    'append_text'  => env('SMS_CHANNEL_APPEND_TEXT', "\n\n\n لغو ۱۱"),
];
```

---

Usage
-----

[](#usage)

Create a notification and send it through the `sms` channel:

```
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    public function via(object $notifiable): array
    {
        return ['sms'];
    }

    public function toSms(object $notifiable): string
    {
        return "Your invoice was paid. Amount: {$notifiable->amount}";
    }
}
```

Send it to a notifiable model that exposes a phone number (either `mobile` or `routeNotificationFor('sms', ...)`):

```
$user->notify(new InvoicePaid());
```

Or send to a phone number directly:

```
use Illuminate\Support\Facades\Notification;

Notification::route('sms', '09121234567')->notify(new InvoicePaid());
```

### Recipient resolution

[](#recipient-resolution)

1. `$notifiable->routeNotificationFor('sms', $notification)` if it exists, then
2. `$notifiable->mobile` if it is set, then
3. the `fb-sms.receiver` config value, or
4. the route value passed to `Notification::route('sms', ...)`.

### Success and failure hooks

[](#success-and-failure-hooks)

```
class InvoicePaid extends Notification
{
    public function succeeded($operator): void
    {
        // $operator->getCode() / getMessage() hold the provider response
    }

    public function failed(\Throwable $exception): void
    {
        // log, alert, retry...
    }
}
```

### Credit lookup

[](#credit-lookup)

```
use Mortezamasumi\FbSms\Facades\FbSms;

FbSms::credit(); // '125000' — 'N/A' when the provider is unreachable
```

### Custom operators

[](#custom-operators)

Implement your own provider by extending `Mortezamasumi\FbSms\Contracts\Operator` and implement `send()` and `credit()`:

```
use Mortezamasumi\FbSms\Contracts\Operator;

class MyOperator extends Operator
{
    public function send(): void
    {
        // $this->getText()   — message body
        // $this->getTo()     — recipient(s)
        // $this->getGateway()— sender line
        // $this->setCode('1'); $this->setMessage('ok');
    }

    public function credit(): string
    {
        return '10000';
    }
}
```

Register it via config:

```
'operator' => env('SMS_CHANNEL_OPERATOR', App\Sms\MyOperator::class),
```

If your operator needs app-level setup, override `public static function initialize(FbSmsServiceProvider $provider): void` — it runs once before the operator is first used.

---

Support policy
--------------

[](#support-policy)

PHPLaravel8.312---

Testing
-------

[](#testing)

```
composer test
```

The test suite covers operator responses, recipient resolution, lifecycle hooks, and failure paths using `Http::fake()` and the bundled `Fake` operator — no real SMS is sent.

---

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover a security vulnerability, please review our [security policy](.github/SECURITY.md) on how to report it.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for recent changes.

---

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for details.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance97

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~62 days

Total

17

Last Release

17d ago

Major Versions

v1.0.0 → v2.0.02025-08-06

v2.0.0 → v3.0.02025-08-06

v3.0.0 → v4.0.02025-08-06

v4.3.1 → v5.0.02026-07-09

PHP version history (2 changes)v1.0.0PHP ^8.2

v4.1.1PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/41052038?v=4)[M.M](/maintainers/mortezamasumi)[@mortezamasumi](https://github.com/mortezamasumi)

---

Top Contributors

[![mortezamasumi](https://avatars.githubusercontent.com/u/41052038?v=4)](https://github.com/mortezamasumi "mortezamasumi (22 commits)")

---

Tags

laravelnotificationsmsfilamentpersianchannelsmsirsabanovinmortezamasumifb-sms

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mortezamasumi-fb-sms/health.svg)

```
[![Health](https://phpackages.com/badges/mortezamasumi-fb-sms/health.svg)](https://phpackages.com/packages/mortezamasumi-fb-sms)
```

###  Alternatives

[backstage/mails

View logged mails and events in a beautiful Filament UI.

16429.7k](/packages/backstage-mails)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

316.8k2](/packages/finity-labs-fin-mail)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

85240.3k9](/packages/stephenjude-filament-two-factor-authentication)[marcelweidum/filament-passkeys

Use passkeys in your filamentphp app

6758.2k2](/packages/marcelweidum-filament-passkeys)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

16461.2k](/packages/relaticle-custom-fields)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
