PHPackages                             terenaa/sms-gateway - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. terenaa/sms-gateway

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

terenaa/sms-gateway
===================

Just another simple PHP SMS Gateway

v1.2.0(10y ago)029MITPHPPHP &gt;=5.3.0

Since Dec 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/terenaa/sms-gateway)[ Packagist](https://packagist.org/packages/terenaa/sms-gateway)[ RSS](/packages/terenaa-sms-gateway/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

SMS Gateway
===========

[](#sms-gateway)

Just another simple PHP SMS Gateway

Alternative, independently developed version: [Dreamer1258/sms-gateway](https://github.com/Dreamer1258/sms-gateway)

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

[](#installation)

```
composer require terenaa/sms-gateway

```

Examples
--------

[](#examples)

### Basic

[](#basic)

Sends single text message.

```
require_once __DIR__ . '/vendor/autoload.php';

use terenaa\SmsGateway\SmsGateway;

try {
    $sms = new SmsGateway();
    $sms->send('123456789', 'The message');
} catch (SmsGatewayException $e) {
    echo $e->getMessage();
}
```

### Multiple recipients

[](#multiple-recipients)

Sends single text message to multiple recipients

```
require_once __DIR__ . '/vendor/autoload.php';

use terenaa\SmsGateway\SmsGateway;

try {
    $sms = new SmsGateway();
    $sms->sendMultiple(array('123456789', '234567891'), 'The message');
} catch (SmsGatewayException $e) {
    echo $e->getMessage();
}
```

### Bash alias with options

[](#bash-alias-with-options)

Sends single text message from terminal

```
alias sms="/home/USERNAME/Scripts/SMSGateway/sms.php"
```

```
// /home/USERNAME/Scripts/SMSGateway/sms.php

require_once __DIR__ . '/vendor/autoload.php';

use terenaa\SmsGateway\SmsGateway;
use terenaa\SmsGateway\SmsGatewayException;

$opts = getopt('p:m:s::b::', array('phone:', 'msg:', 'sig::', 'phoneback::'));
$phone = fetchOpt($opts, array('p', 'phone'));
$msg = fetchOpt($opts, array('m', 'msg'));
$sig = fetchOpt($opts, array('s', 'sig'));
$phoneback = fetchOpt($opts, array('b', 'phoneback'));

if (!$phone || !$msg) {
    echo "Usage: sms --phone= --msg= [--sig= [--phoneback=]]\n";
    exit;
}

try {
    $sms = new SmsGateway();

    if ($sms->send($phone, $msg, $sig, $phoneback)) {
        echo "Message has been sent.\n";
    } else {
        echo "Something went wrong...\n";
    }
} catch (SmsGatewayException $e) {
    echo $e->getMessage();
}

function fetchOpt($opts, array $names)
{
    foreach ($names as $name) {
        if (isset($opts[$name])) {
            return $opts[$name];
        }
    }

    return null;
}
```

### Phone book

[](#phone-book)

The previous example extended with a phone book.

```
require_once __DIR__ . '/vendor/autoload.php';

use terenaa\SmsGateway\Contact;
use terenaa\SmsGateway\SmsGateway;
use terenaa\SmsGateway\SmsGatewayException;

$opts = getopt('p:m:s::b::c::', array('phone:', 'msg:', 'sig::', 'phoneback::', 'contact::', 'save'));
$phone = fetchOpt($opts, array('p', 'phone'));
$msg = fetchOpt($opts, array('m', 'msg'));
$sig = fetchOpt($opts, array('s', 'sig'));
$phoneback = fetchOpt($opts, array('b', 'phoneback'));
$name = fetchOpt($opts, array('c', 'contact'));
$save = fetchOpt($opts, array('save'));

if ((!$phone && !$name) || !$msg) {
    echo "Usage:\n\n"
        . "    sms -p|-c phone number or contact's name -m message [-s signature]\n\t[-b phoneback] [-c contact name] [-s]\n\n"
        . "OPTIONS\n"
        . "\t-p, --phone=NUMBER\n"
        . "\t\trecipient's phone number, required\n\n"
        . "\t-m, --msg=MESSAGE\n"
        . "\t\tthe message, required\n\n"
        . "\t-s, --sig=SIGNATURE\n"
        . "\t\tsender's signature\n\n"
        . "\t-b, --phoneback=NUMBER\n"
        . "\t\tsender's phone number\n\n"
        . "\t-c, --contact=NAME\n"
        . "\t\tnew contact's name (only if -s option used)\n\n"
        . "\t--save\n"
        . "\t\t save new contact\n\n";
    exit;
}

try {
    $sms = new SmsGateway();
    $contact = new Contact();

    if ($name && !$phone) {
        $phone = $contact->getPhone($name);

        if ($phone) {
            echo "Found {$name}'s number ({$phone}).\n";
        } else {
            echo "Cannot find '{$name}' in your phone book.\n";
            exit;
        }
    }

    if ($sms->send($phone, $msg, $sig, $phoneback)) {
        echo "Message has been sent.\n";
    } else {
        echo "Something went wrong...\n";
    }

    if ($save && $name && $phone) {
        $saved = $contact->create($phone, $name);

        if ($saved) {
            echo "Contact '{$name}' has been saved.\n";
        } else {
            echo "Cannot save contact.\n";
        }
    }
} catch (SmsGatewayException $e) {
    echo $e->getMessage();
}

function fetchOpt($opts, array $names)
{
    foreach ($names as $name) {
        if (isset($opts[$name])) {
            return $opts[$name] ? $opts[$name] : true;
        }
    }

    return null;
}
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% 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

3836d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4800842?v=4)[Krzysztof Janda](/maintainers/terenaa)[@terenaa](https://github.com/terenaa)

---

Top Contributors

[![dmarcak](https://avatars.githubusercontent.com/u/3889840?v=4)](https://github.com/dmarcak "dmarcak (12 commits)")[![terenaa](https://avatars.githubusercontent.com/u/4800842?v=4)](https://github.com/terenaa "terenaa (6 commits)")[![dreamer1258](https://avatars.githubusercontent.com/u/113742906?v=4)](https://github.com/dreamer1258 "dreamer1258 (1 commits)")

---

Tags

sms-gatewayterenaa

### Embed Badge

![Health badge](/badges/terenaa-sms-gateway/health.svg)

```
[![Health](https://phpackages.com/badges/terenaa-sms-gateway/health.svg)](https://phpackages.com/packages/terenaa-sms-gateway)
```

###  Alternatives

[ergebnis/clock

Provides abstractions of a clock.

301.2M](/packages/ergebnis-clock)[nmure/crawler-detect-bundle

A Symfony bundle for the Crawler-Detect library (detects bots/crawlers/spiders via the user agent)

26282.5k](/packages/nmure-crawler-detect-bundle)[silverstripe/versioned-snapshots

SilverStripe Versioned Snapshots

1418.2k1](/packages/silverstripe-versioned-snapshots)

PHPackages © 2026

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