PHPackages                             webxscripts/laravel-smsapi-notification-channel - 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. webxscripts/laravel-smsapi-notification-channel

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

webxscripts/laravel-smsapi-notification-channel
===============================================

Modern Laravel Notification Channel for SmsApi PHP Client

1.0.0(1y ago)048MITPHPPHP ^8.2

Since Jul 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/WebXScripts/laravel-smsapi-notification-channel)[ Packagist](https://packagist.org/packages/webxscripts/laravel-smsapi-notification-channel)[ Docs](https://github.com/WebXScripts/laravel-smsapi-notification-channel)[ RSS](/packages/webxscripts-laravel-smsapi-notification-channel/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Laravel SmsApi Notification Channel
===================================

[](#laravel-smsapi-notification-channel)

[![Latest Version](https://camo.githubusercontent.com/ba3b6b0a4fdacd3c2c1e0a526813258c1e62a3e712c2139d98a3053a9b25e6b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77656278736372697074732f6c61726176656c2d736d736170692d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webxscripts/laravel-smsapi-notification-channel)[![Total Downloads](https://camo.githubusercontent.com/9753138209097fb85fb01cbbcf79fb2d7f4e20baa5bd3bff04eeb01a7eed6757/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77656278736372697074732f6c61726176656c2d736d736170692d6e6f74696669636174696f6e2d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webxscripts/laravel-smsapi-notification-channel)

A Laravel 11+ notification channel for [SmsApi](https://www.smsapi.com/) with PHP 8.2+ support.

---

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11 or newer
- SmsApi account and API token

---

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

[](#installation)

```
composer require webxscripts/laravel-smsapi-notification-channel
php artisan vendor:publish --tag=smsapi-config
```

---

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

[](#configuration)

Add the following to your `.env` file:

```
SMSAPI_TOKEN=your_api_token_here
SMSAPI_SERVICE=com
SMSAPI_FROM=YourApp
```

Supported services:

- `com` (default)
- `pl`
- For other regions, use: ```
    SMSAPI_URI=https://api.smsapi.se/
    ```

---

Basic Usage
-----------

[](#basic-usage)

Create a notification:

```
php artisan make:notification OrderConfirmation
```

Example implementation:

```
use Illuminate\Notifications\Notification;
use WebXScripts\SmsApiNotification\SmsApiMessage;

class OrderConfirmation extends Notification
{
    public function __construct(private string $orderNumber) {}

    public function via($notifiable): array
    {
        return ['smsapi'];
    }

    public function toSmsApi($notifiable): SmsApiMessage
    {
        return SmsApiMessage::create("Order #{$this->orderNumber} confirmed.")
            ->from('MyShop');
    }
}
```

---

Advanced Example
----------------

[](#advanced-example)

```
SmsApiMessage::create('Code: 123456')
    ->from('MyApp')
    ->encoding('utf-8')
    ->test(app()->environment('testing'))
    ->fast(true)
    ->normalize(true)
    ->single(false)
    ->expirationDate(now()->addMinutes(5))
    ->notifyUrl('https://example.com/sms-delivery')
    ->template('verification_code')
    ->param1($this->code)
    ->param2($notifiable->name);
```

---

Phone Number Resolution Order
-----------------------------

[](#phone-number-resolution-order)

1. `SmsApiNotifiable` interface:

    ```
    public function getSmsApiPhoneNumber(): string
    {
        return $this->phone_number;
    }
    ```
2. `routeNotificationForSmsApi()` method
3. `routeNotificationForSms()` method
4. Model attributes: `phone` or `phone_number`

---

Sending Notifications
---------------------

[](#sending-notifications)

```
$user->notify(new OrderConfirmation('ORD-12345'));

Notification::send($users, new OrderConfirmation('ORD-12345'));

Notification::route('smsapi', '+48123456789')
    ->notify(new OrderConfirmation('ORD-12345'));
```

---

Available Message Methods
-------------------------

[](#available-message-methods)

```
SmsApiMessage::create('...')
    ->from(string)
    ->encoding(string)
    ->test(bool)
    ->fast(bool)
    ->normalize(bool)
    ->noUnicode(bool)
    ->single(bool)
    ->notifyUrl(string)
    ->expirationDate(DateTimeInterface)
    ->timeRestriction(string)
    ->partnerId(string)
    ->checkIdx(bool)
    ->idx(array)
    ->template(string)
    ->param1(string)
    ->param2(string)
    ->param3(string)
    ->param4(string);
```

All methods return an immutable instance.

---

Error Handling
--------------

[](#error-handling)

Custom exceptions provided:

- `MissingPhoneNumberException`
- `MissingApiTokenException`
- `InvalidNotificationException`

Example:

```
try {
    $user->notify(new OrderConfirmation('ORD-12345'));
} catch (MissingPhoneNumberException $e) {
    Log::warning('User has no phone number');
}
```

---

Testing &amp; Code Quality
--------------------------

[](#testing--code-quality)

```
composer test            # Run tests
composer test-coverage   # Run with coverage
composer format          # Format code
composer analyse         # Static analysis
```

---

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance50

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

367d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/277d94fb26f992bd00d4f1b755bc795f98d634278baf19b6a746973b2e800e3d?d=identicon)[WebXScripts](/maintainers/WebXScripts)

---

Top Contributors

[![WebXScripts](https://avatars.githubusercontent.com/u/46284084?v=4)](https://github.com/WebXScripts "WebXScripts (7 commits)")

---

Tags

laravelnotificationnotificationsphpphp8php82smssmsapilaravelnotificationsmschannelsmsapi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webxscripts-laravel-smsapi-notification-channel/health.svg)

```
[![Health](https://phpackages.com/badges/webxscripts-laravel-smsapi-notification-channel/health.svg)](https://phpackages.com/packages/webxscripts-laravel-smsapi-notification-channel)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2588.4M17](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M17](/packages/laravel-notification-channels-discord)[ghanem/laravel-smsmisr

Send SMS and SMS Notification via SMS Misr for Laravel

205.0k](/packages/ghanem-laravel-smsmisr)

PHPackages © 2026

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