PHPackages                             robustack/sms - 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. robustack/sms

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

robustack/sms
=============

Laravel-ready SMS manager and routing package with pluggable senders.

v1.0.1(7mo ago)02MITPHPPHP &gt;=8.0CI failing

Since Oct 19Pushed 7mo agoCompare

[ Source](https://github.com/robustak/sms-router)[ Packagist](https://packagist.org/packages/robustack/sms)[ RSS](/packages/robustack-sms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

Robustack SMS
=============

[](#robustack-sms)

Laravel-ready SMS routing with prioritized senders and simple configuration. Register any number of sender classes, route by country or dialing prefix, and the package picks the best available sender with automatic fallback.

Features
--------

[](#features)

- Pluggable senders via a tiny contract
- Priority-aware routing
    - by\_country (ISO alpha-2, requires `giggsey/libphonenumber-for-php`)
    - by\_prefix (digits only, longest match wins)
    - default sender, then implicit 'log' fallback
- Central manager for registration and dispatch
- Factory to choose and send via the best sender
- Laravel service provider, facade, publishable config
- Auto-merge per-sender config into `$config` passed to send()

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

[](#installation)

```
composer require robustack/sms
php artisan vendor:publish --provider="Robustack\\Sms\\Providers\\SmsServiceProvider" --tag=config
```

Optional for better region detection (enables by\_country):

```
composer require giggsey/libphonenumber-for-php
```

Configure
---------

[](#configure)

`config/sms.php`

```
return [
    'default_sender' => 'log',

    'senders' => [
        'log' => [
            'class' => \Robustack\Sms\Senders\LogSender::class,
            'config' => [],
        ],
        // 'twilio' => [
        //     'class' => \App\Sms\TwilioSender::class,
        //     'config' => ['from' => env('TWILIO_FROM')],
        // ],
    ],

    'routing' => [
        'default' => 'log',
        'by_country' => [
            'US' => ['twilio', 'log'],
        ],
        'by_prefix' => [
            '1' => ['twilio', 'log'],
            '20' => ['vonage', 'log'],
        ],
    ],
];
```

Notes

- Each sender's `config` is automatically merged into the `$config` argument passed at runtime; runtime values override file config.
- The container resolves sender dependencies; type-hint what you need in the constructor.

Usage
-----

[](#usage)

```
// Choose and send via the best sender
app(\Robustack\Sms\SmsFactory::class)->send('+14155550100', 'Hello', ['from' => '+11234567890']);

// Facade
\Robustack\Sms\Facades\Sms::send('+201234567890', 'مرحبا');

// Inspect routing decision
$name = \Robustack\Sms\Facades\Sms::chooseSenderName('+201234567890');
```

Implement a sender
------------------

[](#implement-a-sender)

Implement `Robustack\Sms\Contracts\SmsSenderContract`:

```
namespace App\Sms;

use Robustack\Sms\Contracts\SmsSenderContract;

class TwilioSender implements SmsSenderContract
{
    public function __construct(private \Twilio\Rest\Client $client) {}

    public function send(string $to, string $message, array $config = []): bool
    {
        $from = $config['from'] ?? env('TWILIO_FROM');
        $this->client->messages->create($to, ['from' => $from, 'body' => $message]);
        return true;
    }
}
```

Register in config only (no manual registration needed):

```
'senders' => [
    'twilio' => [
        'class' => \App\Sms\TwilioSender::class,
        'config' => [
            'from' => env('TWILIO_FROM'),
        ],
    ],
],
```

The package resolves `Twilio\Rest\Client` from the container and merges `senders.twilio.config` into `$config` when calling `send()`.

Priority and fallback
---------------------

[](#priority-and-fallback)

Order of selection:

1. `by_country` match (if libphonenumber installed)
2. `by_prefix` match (longest match first)
3. `routing.default`
4. Implicit `'log'` sender if registered

If a sender throws or returns false, the next candidate is tried automatically.

Advanced
--------

[](#advanced)

- Dynamic registration

```
app(\Robustack\Sms\SmsManager::class)->register('custom', new CustomSender(...));
```

- Per-request overrides

```
\Robustack\Sms\Facades\Sms::send('+14155550100', 'Hello', ['from' => '+10987654321']);
```

Testing
-------

[](#testing)

```
composer install
composer test
```

CI
--

[](#ci)

GitHub Actions workflow in `.github/workflows/ci.yml` runs tests on PHP 8.0–8.2.

Suggested provider SDKs
-----------------------

[](#suggested-provider-sdks)

```
composer require twilio/sdk
composer require vonage/client-core vonage/client
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance65

Regular maintenance activity

Popularity2

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity41

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

Every ~0 days

Total

2

Last Release

212d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/146a1c5b3b183e24e04b5a3cf87a120e4657b595fd2d9d076a61ec2bc36435d6?d=identicon)[robustack](/maintainers/robustack)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[illuminate/pipeline

The Illuminate Pipeline package.

9346.6M213](/packages/illuminate-pipeline)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[mrmarchone/laravel-auto-crud

Laravel Auto CRUD helps you streamline development and save time.

28711.8k2](/packages/mrmarchone-laravel-auto-crud)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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