PHPackages                             smsaero/smsaero\_laravel - 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. smsaero/smsaero\_laravel

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

smsaero/smsaero\_laravel
========================

Laravel integration for the SmsAero API: facade, DI, notification channel.

v1.0.0(today)00MITPHPPHP ^8.1

Since Jun 19Pushed todayCompare

[ Source](https://github.com/smsaero/smsaero_laravel)[ Packagist](https://packagist.org/packages/smsaero/smsaero_laravel)[ RSS](/packages/smsaero-smsaero-laravel/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (2)Used By (0)

PHP Laravel library for sending SMS messages via SMS Aero API
=============================================================

[](#php-laravel-library-for-sending-sms-messages-via-sms-aero-api)

[![Latest Stable Version](https://camo.githubusercontent.com/6aee70f274dcc39729b013560f938cc82f09273d2b4685bbf906e46b3a5de4e0/68747470733a2f2f706f7365722e707567782e6f72672f736d736165726f2f736d736165726f5f6c61726176656c2f76)](https://packagist.org/packages/smsaero/smsaero_laravel)[![PHP Version Require](https://camo.githubusercontent.com/6e40e6c08aff6660bc0144225194f90e769c3de5a8062ab1a40bb3f2f5ebbd64/68747470733a2f2f706f7365722e707567782e6f72672f736d736165726f2f736d736165726f5f6c61726176656c2f726571756972652f706870)](https://packagist.org/packages/smsaero/smsaero_laravel)[![Total Downloads](https://camo.githubusercontent.com/baf694260b59100a19e1e0a3a7aadc16adc3f9a612aaeb191c0713052d71345c/68747470733a2f2f706f7365722e707567782e6f72672f736d736165726f2f736d736165726f5f6c61726176656c2f646f776e6c6f616473)](https://packagist.org/packages/smsaero/smsaero_laravel)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Laravel integration for the [SmsAero API](https://smsaero.ru/integration/documentation/api/): facade, dependency injection, and a queueable notification channel on top of the `smsaero/smsaero_api` library.

Documentation in Russian: [README.RUS.md](README.RUS.md)

Installation (from Packagist):
------------------------------

[](#installation-from-packagist)

```
composer require smsaero/smsaero_laravel
```

The service provider and `SmsAero` facade are registered automatically via package discovery.

Configuration:
--------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=smsaero-config
```

Set credentials in `.env`. Get them from the account settings page:

```
SMSAERO_EMAIL=your@email.com
SMSAERO_API_KEY=your-api-key
SMSAERO_SIGN="SMS Aero"
```

Usage example:
--------------

[](#usage-example)

### Facade

[](#facade)

```
use SmsAero\Laravel\Facades\SmsAero;

SmsAero::message()->send([
    'number' => '70000000000',
    'text'   => 'Hello, World!',
]);

$balance = SmsAero::user()->getBalance();
```

Available domain clients: `message()`, `contact()`, `group()`, `user()`, `viber()`, `whatsapp()`, `telegram()`, `mobileId()`.

### High-level send (typed)

[](#high-level-send-typed)

`sendSms()` fills `sign` from config, normalizes the response, throws typed exceptions and returns a `SmsAeroResult`:

```
use SmsAero\Laravel\Facades\SmsAero;

$result = SmsAero::sendSms('70000000000', 'Hello, World!');
// $result->id, $result->status, $result->cost, $result->recipient, $result->raw
```

On `success=false` it throws `ApiException`; on a transport failure, `ConnectionException`.

### Strict mode

[](#strict-mode)

`guard()` runs every domain call through response normalization and typed exceptions:

```
$balance = SmsAero::guard()->user()->getBalance();
SmsAero::guard()->message()->send(['number' => '70000000000', 'text' => 'Hi', 'sign' => 'SMS Aero']);
```

The raw passthrough `SmsAero::message()->send([...])` (returns array, throws the base `\Exception`) is kept for backward compatibility.

### Dependency injection

[](#dependency-injection)

```
use SmsAero\SmsAeroMessage;

public function __construct(private SmsAeroMessage $sms) {}

$this->sms->send(['number' => '70000000000', 'text' => 'Hello, World!']);
```

### Notification channel

[](#notification-channel)

```
use Illuminate\Notifications\Notification;
use SmsAero\Laravel\Notifications\SmsAeroMessage;

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

    public function toSmsAero(object $notifiable): SmsAeroMessage
    {
        return SmsAeroMessage::create("Order #{$this->id} shipped")->sign('MyShop');
    }
}
```

The recipient number is resolved from `routeNotificationForSmsAero()`, then the `sms` channel route, then the `phone` / `phone_number` attribute:

```
public function routeNotificationForSmsAero(): string
{
    return $this->phone;
}
```

### Queueing

[](#queueing)

Add `implements ShouldQueue` to the notification to deliver it through a queue:

```
class OrderShipped extends Notification implements ShouldQueue
{
    use Queueable;
}
```

Testing:
--------

[](#testing)

`SmsAero::fake()` swaps the client with a recording double and exposes assertions:

```
use SmsAero\Laravel\Facades\SmsAero;

$fake = SmsAero::fake();

// ... code under test sends SMS ...

$fake->assertSent();
$fake->assertSentTo('70000000000');
$fake->assertSentCount(1);
$fake->assertNothingSent();
```

Exceptions:
-----------

[](#exceptions)

The notification channel throws typed exceptions:

- `SmsAero\Laravel\Exceptions\SmsAeroException` — base exception for all exceptions raised by the package.
- `SmsAero\Laravel\Exceptions\ConnectionException` — network failure, gate unavailability, empty or malformed response. Retryable by the queue.
- `SmsAero\Laravel\Exceptions\ApiException` — API rejection (`success=false`). The full response body is available on `$exception->response`.

Direct facade/DI calls return arrays and raise the base `\Exception` from the `smsaero/smsaero_api` library.

Security:
---------

[](#security)

- Credentials are read only from `env()` inside `config/smsaero.php`.
- `php artisan config:cache` bakes the values into `bootstrap/cache/config.php` — do not ship that file in a Docker image together with a real `.env`; provide secrets through runtime mechanisms (Docker/K8s secrets, Vault).
- Add `api_key`, `apiKey`, `authorization`, `SMSAERO_*` to your Sentry/log scrubber and mask phone numbers.
- Validate `callbackUrl` (Mobile ID) on the application side (https only, trusted host) — it is a potential SSRF vector.

Compatibility:
--------------

[](#compatibility)

- PHP 8.1+
- Laravel 10, 11, 12

License:
--------

[](#license)

```
MIT License

```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

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

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/129125589?v=4)[SMS Aero](/maintainers/smsaero)[@smsaero](https://github.com/smsaero)

---

Tags

laravelnotificationsmssmsaero

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/smsaero-smsaero-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/smsaero-smsaero-laravel/health.svg)](https://phpackages.com/packages/smsaero-smsaero-laravel)
```

###  Alternatives

[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2588.1M15](/packages/laravel-notification-channels-twilio)[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.7M42](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2401.4M13](/packages/laravel-notification-channels-discord)[gr8shivam/laravel-sms-api

A modern, flexible Laravel package for integrating any SMS gateway with REST API support

10139.9k](/packages/gr8shivam-laravel-sms-api)[ghanem/laravel-smsmisr

Send SMS and SMS Notification via SMS Misr for Laravel

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

PHPackages © 2026

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