Увійти Реєстрація
Блог Серії
Кар'єра
Вакансії Компанії
Навчання
Документація Співбесіди Тестування Відео
Екосистема
Пакети Ресурси Проєкти Події
Інше
Про нас

TurboSMS Notification Channel

sashalenz/turbosms-notification-channel
1.1.0 13 426 8 травня 2026
На GitHub

Канал сповіщень Laravel для TurboSMS REST API: надсилання SMS і Viber-повідомлень через стандартний механізм нотифікацій. Підтримує Laravel 11-13, на відміну від старіших обгорток TurboSMS.

0

Поділитись

README

TurboSMS notification channel for Laravel

Latest Version on Packagist Total Downloads License

A Laravel notification channel for the TurboSMS REST API.

This is a drop-in replacement for the abandoned laravel-notification-channels/turbosms package, which still talks to the long-deprecated SOAP endpoint and fails on modern PHP with SoapClient::__construct(): 'location' and 'uri' options are required in nonWSDL mode.

Why this package

  • Talks to the current TurboSMS REST API (https://api.turbosms.ua), not the dead SOAP endpoint.
  • Won't crash your queue. Auth, transport, and per-recipient errors are logged at warning level instead of being thrown — so a flaky provider or a missing API key cannot drown your worker in retries.
  • Sandbox mode that short-circuits before any HTTP call — useful for local dev where you don't want to spend credits.
  • Auto-normalises phones+380501234567, 380501234567, +38 (050) 123-45-67 all become 380501234567 before hitting the API.

Installation

composer require sashalenz/turbosms-notification-channel

The service provider is registered automatically via package discovery.

Publish the config (optional — env-driven defaults work out of the box):

php artisan vendor:publish --tag="turbosms-config"

Configuration

Set the following keys in your .env:

TURBOSMS_API_KEY=your-bearer-token-from-the-dashboard
TURBOSMS_SENDER=YourAlpha

# Optional
TURBOSMS_SANDBOX_MODE=false
TURBOSMS_DEBUG=false
TURBOSMS_BASE_URL=https://api.turbosms.ua
TURBOSMS_TIMEOUT=10

The Bearer token is issued in the TurboSMS dashboard.

Usage

1. Notification

Add the channel to your notification's via() and implement toTurboSms:

use Illuminate\Notifications\Notification;
use Sashalenz\TurboSms\TurboSmsChannel;
use Sashalenz\TurboSms\TurboSmsMessage;

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

    public function toTurboSms(object $notifiable): TurboSmsMessage
    {
        return new TurboSmsMessage("Your order #{$notifiable->id} has shipped.");
    }
}

Method names in PHP are case-insensitive, so legacy notifications declaring toTurboSMS will keep working without modification.

2. Notifiable

Provide the recipient phone via routeNotificationForTurbosms (or the case-insensitive equivalent routeNotificationForTurboSMS). Any common format works — the channel strips non-digit characters before sending:

class User extends Authenticatable
{
    use Notifiable;

    public function routeNotificationForTurbosms(): string
    {
        return $this->phone; // '+380501234567' → '380501234567' on the wire
    }
}

3. Send

$user->notify(new OrderShipped($order));

Sandbox mode

Set TURBOSMS_SANDBOX_MODE=true to short-circuit every send. No HTTP request is made; if TURBOSMS_DEBUG=true the would-be payload is logged at info level. Useful in local/staging environments.

Failure semantics

The channel is intentionally non-throwing — every failure path logs a warning and returns:

Scenario Result Log level
sandbox_mode = true no-op info (only if debug = true)
Empty api_key or sender no-op warning
Empty recipient phone or message body no-op none
Transport error (timeout, DNS, refused) no-op warning
HTTP 401 / 403 no-op warning
Other non-2xx no-op warning
Envelope response_code != 0 (e.g. insufficient funds) no-op warning
Per-recipient response_code != 0 (e.g. invalid phone) no-op warning
Successful send sent info (only if debug = true)

This matches the design constraint that a misconfigured SMS provider should not block delivery, fiscalisation, or any other queued workflow that happens to dispatch an SMS as a side-effect.

Testing

composer test

Tests use Http::fake() and Orchestra Testbench — no real HTTP calls are made.

License

MIT — see LICENSE.

Читати в документації

Коментарі

Увійдіть, щоб залишити коментар

Будьте першим, хто залишить коментар!

Схожі пакети

SendPulse REST API

sendpulse/rest-api

Офіційний PHP SDK для SendPulse: email-розсилки, SMS, web-push, чат-боти та транзакційна пошта. Сервіс заснований в Україні і виріс у міжнародну платформу, тож SDK підтримується активно і має найбільшу аудиторію в добірці.

117 3.0.1 10

NovaPoshta for Laravel

daaner/novaposhta

Обгортка над API 2.0 Нової Пошти для Laravel: адреси, відділення, вантажі, документи та відстеження посилок. Один із найпоширеніших пакетів для інтеграції з Новою Поштою в українських проєктах.

36 1.4 7 8

MonoPay

plakidan/monobank-pay

Бібліотека для еквайрингу monobank («plata by mono»): створення рахунків, статуси оплат, повернення коштів і холди. Найпопулярніший пакет для прийому платежів через monobank, з активними релізами.

33 0.3.1 5

TurboSMS for Laravel

daaner/turbosms

Пакет для роботи з TurboSMS у Laravel: надсилання SMS і Viber, перевірка балансу та статусів доставки. Один із найпоширеніших SMS-пакетів в українських Laravel-проєктах.

22 1.40 7

Monobank for Laravel

aratkruglik/monobank-laravel

Інтеграція з API monobank для Laravel 11-13: еквайринг, виписки за рахунками, курси валют і вебхуки. Актуально підтримується під сучасні версії фреймворку.

8 2.0.1 13 5

Checkbox.in.ua SDK

kolirt/checkbox.in.ua-sdk

PHP SDK для Checkbox.in.ua: робота з касами, змінами та фіскальними чеками через REST API. Альтернативна реалізація клієнта ПРРО Checkbox для проєктів без прив'язки до Laravel.

5 0.0.6 1