Download the PHP package tekkenking/swissecho without Composer

On this page you can find all versions of the php package tekkenking/swissecho. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package swissecho

๐Ÿ“จ Swissecho โ€” Laravel Multi-Channel Notification Package

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)

Channel Description Supported Gateways
SMS Traditional text messages Termii, RouteMobile, SmsBroadcast (AU), TNZ (NZ), NigerianBulkSMS, Montnets, Wirepick
Voice Voice OTP / voice calls Termii, Textng.xyz
WhatsApp WhatsApp messaging KudiSMS
Slack Slack notifications Built-in Slack route

Key Features


Requirements

Dependency Supported Versions
PHP ^8.1
Laravel 11.x, 12.x, 13.x

Installation

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


Configuration

Environment Variables

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

The Config File

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

Key Purpose
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

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

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


๐Ÿ”Œ 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

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

How it works under the hood: after send() returns the cURL handle, Swissecho's SwissechoGatewayTrait::execCurl() calls curl_exec(), collects the response, formats it, and fires the AfterSend event.


Step 2: Register the Gateway in the Config

Open config/swissecho.php and add your gateway to the routes_options.sms.gateway_options array:

Add the corresponding values to your .env:


Step 3: Use Your Gateway

That's it โ€” your gateway is now a first-class citizen in Swissecho. Use it exactly like any built-in gateway:

You can also map it to a country in places for automatic geo-routing:


BaseGateway Quick Reference

Member Type Description
$this->to array Recipient phone numbers
$this->sender string Sender ID / name
$this->body string The message text
$this->config array Your gateway's full config block from swissecho.php
init(): mixed abstract method Build the request payload; return value is passed to send()
send($data): \CurlHandle|bool abstract method Set up and return a cURL handle; Swissecho executes it

Usage

Swissecho can be used in two ways: directly (without a Notification class), or through Laravel's notification system.

Access Methods

You have three ways to get a Swissecho instance:


A) Direct Sending (Without Notification Classes)

Quick Send โ€” One Liner

The simplest way to send a message. Uses the default route and default gateway from config:

Quick Send with a Specific Gateway

Fluent Builder โ€” Full Control

Property-Based Sending

You can also set properties directly on the Swissecho instance:

Sending via WhatsApp

Sending via Slack

Sending via Voice Call


B) Laravel Notification Channel Integration

Swissecho integrates with Laravel's built-in notification system. Create a notification class and define a toSms (or toVoice, toWhatsapp, toSlack) method:

Step 1: Create the Notification

Step 2: Make Your User Model "Notifiable"

Swissecho pulls the phone number from the notifiable model. Implement one of these:

Step 3: Send the Notification


SwissechoMessage API Reference

The SwissechoMessage class is the message builder used in callbacks and notification methods:

Method Description Example
->line($text) Appends a line of text to the message body. Multiple calls add new lines. ->line('Hello')
->content($text) Alias for line(). ->content('Hello')
->to($recipient) Sets the recipient(s). Accepts a string or comma-separated list. ->to('234801..., 234809...')
->sender($name) Sets the sender ID (max 10 characters). ->sender('MyApp')
->from($name) Alias for sender(). ->from('MyApp')
->gateway($name) Overrides the gateway for this message. ->gateway('termii')
->place($code) Sets the country/place code (e.g., 'nga'). Overrides auto-detection. ->place('nga')
->phonecode($code) Manually sets the phone country code (e.g., '234'). ->phonecode('234')
->identifier($id) Attaches an identifier (e.g., user ID) to the message for tracking. ->identifier($user->id)
->route($name) Sets the route/channel on the message itself. ->route('sms')

Mock Mode (Development & Testing)

When SWISSECHO_ENABLED=false (the default), no real API calls are made. Instead, messages are captured by the mock system.

Mock via Log (Default)

Messages are written to storage/logs/swissecho_mock.log:

The log includes: sender, recipient, message body, route, gateway, gateway class, country, and phone code.

Mock via Email

Messages are emailed to the configured address:


Events

After every message send (including mock sends), Swissecho dispatches the AfterSend event:

Event Properties

Property Type Description
$insightPayload array Contains request (the payload sent to the gateway) and response (raw gateway response)
$formattedResponse array Structured response with status, partner_response, from, to, body, route, gateway, identifier, timestamp
$identifier mixed The identifier attached to the message (e.g., user ID)

Listening to the Event


Webhooks

Swissecho includes a built-in webhook handler for receiving delivery reports or callbacks from gateway providers. The webhook system validates a secret key and routes the request to the appropriate gateway handler.

Configure webhooks per gateway in config/swissecho.php:


Helper Functions

Swissecho provides global helper functions for phone number manipulation:

Function Description
swissecho() Returns the Swissecho singleton instance
addCountryCodeToPhoneNumber($phone, $code) Prepends a country code (e.g., '234') to a phone number, stripping leading 0 or +
removeCountryCodeFromPhoneNumber($phone, $code) Strips a country code prefix from a phone number
convertPhoneNumberToArray($phone) Splits a comma-separated phone string into an array

Examples


License

This package is open-sourced software licensed under the MIT license.


All versions of swissecho with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tekkenking/swissecho contains the following files

Loading the files please wait ...