PHPackages                             tekkenking/swissecho - 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. tekkenking/swissecho

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

tekkenking/swissecho
====================

A multigateway laravel SMS notification channel package

0.7.3(2mo ago)14852MITPHPPHP ^8.1

Since Jul 5Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/tekkenking/swissecho)[ Packagist](https://packagist.org/packages/tekkenking/swissecho)[ RSS](/packages/tekkenking-swissecho/feed)WikiDiscussions master Synced 2d ago

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

📨 Swissecho — Laravel Multi-Channel Notification Package
========================================================

[](#-swissecho--laravel-multi-channel-notification-package)

What is Swissecho?
------------------

[](#what-is-swissecho)

**Swissecho** is a Laravel package that provides a unified, fluent API for sending messages across **multiple channels** and **multiple gateway providers**. Instead of writing separate integration code for each provider, you configure them all in one place and switch between them with a single method call.

### Supported Channels (Routes)

[](#supported-channels-routes)

ChannelDescriptionSupported Gateways**SMS**Traditional text messagesTermii, RouteMobile, SmsBroadcast (AU), TNZ (NZ), NigerianBulkSMS, Montnets, Wirepick**Voice**Voice OTP / voice callsTermii, Textng.xyz**WhatsApp**WhatsApp messagingKudiSMS**Slack**Slack notificationsBuilt-in Slack route### Key Features

[](#key-features)

- 🔀 **Multi-gateway** — Switch SMS providers per-request or per-country
- 🌍 **Geo-routing (Places)** — Automatically route messages to the correct gateway based on the recipient's country
- 🧪 **Mock mode** — In development, messages are logged to file or sent to email instead of hitting live APIs
- 🔔 **Laravel Notification integration** — Use it as a standard Laravel notification channel
- ⚡ **Direct sending** — Send messages without creating a Notification class
- 📣 **Events** — An `AfterSend` event is dispatched after every message, giving you full insight into requests and responses
- 🪝 **Webhooks** — Built-in webhook handling for provider callbacks (e.g., delivery reports)

---

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

[](#requirements)

DependencySupported Versions**PHP**^8.1**Laravel**11.x, 12.x, 13.x---

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

[](#installation)

```
composer require tekkenking/swissecho
```

The package auto-discovers itself via Laravel's package auto-discovery — no manual registration needed.

---

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

[](#configuration)

### Environment Variables

[](#environment-variables)

Add these to your `.env` file. Only configure the gateways you plan to use:

```
# ── Core Settings ──────────────────────────────────────────
SWISSECHO_ENABLED=false        # Set to true for live/production sending
SWISSECHO_SENDER=MyApp         # Default sender name
SWISSECHO_FAKE=log             # Mock mode: "log" (writes to file) or "mail" (sends email)
SWISSECHO_FAKE_MAIL=admin@example.com  # Email for mock mode when SWISSECHO_FAKE=mail
SWISSECHO_ROUTE=sms            # Default route/channel: sms, voice, whatsapp, slack

# ── Termii (SMS & Voice) ──────────────────────────────────
TERMII_API_KEY=your_api_key
TERMII_SENDER_ID=YourSender
TERMII_URL=https://api.ng.termii.com/api/sms/send

# ── RouteMobile ────────────────────────────────────────────
ROUTEMOBILE_USERNAME=your_username
ROUTEMOBILE_PASSWORD=your_password
ROUTEMOBILE_SENDER_ID=YourSender
ROUTEMOBILE_URL=https://api.routemobile.com/...

# ── SmsBroadcast (Australia) ───────────────────────────────
SMSBRC_DOTCOM_DOT_AU_USERNAME=your_username
SMSBRC_DOTCOM_DOT_AU_PASSWORD=your_password
SMSBRC_DOTCOM_DOT_AU_URL=https://api.smsbroadcast.com.au/...

# ── TNZ (New Zealand) ─────────────────────────────────────
TNZ_API_KEY=your_api_key
TNZ_URL=https://api.tnz.co.nz/...

# ── NigerianBulkSMS ───────────────────────────────────────
NIGERIANBULKSMS_USERNAME=your_username
NIGERIANBULKSM_PASSWORD=your_password
NIGERIANBULKSMS_URL=https://portal.nigeriabulksms.com/api/

# ── Montnets ──────────────────────────────────────────────
MONTNETS_SMS_URL=your_url
MONTNETS_SMS_USERNAME=your_username
MONTNETS_SMS_PASSWORD=your_password

# ── Wirepick ──────────────────────────────────────────────
WIREPICK_SMS_URL=your_url
WIREPICK_SMS_CLIENT=your_client
WIREPICK_SMS_PASSWORD=your_password
WIREPICK_SMS_AFFLIATE=your_affliate

# ── Textng.xyz (Voice) ────────────────────────────────────
TEXTNGXYZ_API_KEY=your_api_key

# ── KudiSMS (WhatsApp) ────────────────────────────────────
KUDISMS_API_KEY=your_api_key
KUDISMS_URL=your_url
```

### The Config File

[](#the-config-file)

You can publish and customize the full config at `config/swissecho.php`. The most important sections are:

KeyPurpose`live``true` = send real messages; `false` = mock mode`sender`Default sender ID/name`fake`Mock strategy: "log" or "mail"`route`Default channel: `sms`, `voice`, `whatsapp`, or `slack``routes_options`Per-channel gateway definitions and geo-routing rules### Geo-Routing with `places`

[](#geo-routing-with-places)

Each route (SMS, voice, WhatsApp) has a `places` map that **automatically picks the right gateway** based on the recipient's country:

```
'sms' => [
    'gateway_options' => [ /* ... */ ],
    'places' => [
        'nga' => [                          // Nigeria
            'gateway'   => 'nigerianbulksms',
            'phonecode' => '234'
        ],
        'gha' => [                          // Ghana
            'gateway'   => 'wirepick',
            'phonecode' => '233'
        ],
        'aus' => [                          // Australia
            'gateway'   => 'smsbroadcast',
            'phonecode' => '61'
        ],
        'nzl' => [                          // New Zealand
            'gateway'   => 'tnz',
            'phonecode' => '64'
        ],
    ]
],
```

The phone code is automatically prepended to phone numbers (stripping leading `0` or `+`).

---

🔌 Adding a Custom SMS Gateway
-----------------------------

[](#-adding-a-custom-sms-gateway)

Swissecho is designed to be easily extensible. If you need a gateway that isn't built in, you can wire up your own in **three steps** — no need to touch the package source at all.

---

### Step 1: Create Your Gateway Class

[](#step-1-create-your-gateway-class)

Create a folder anywhere in your project (e.g., `app/Sms/Gateways/MyProvider/`) and add a class inside it. The class **must**:

- Extend `Tekkenking\Swissecho\Routes\Sms\Gateways\BaseGateway`
- Implement two methods: `init()` and `send()`

```
