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

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

byjg/sms-client
===============

A lightweight, extensible PHP library for sending SMS messages through multiple providers.

6.0.0(7mo ago)09.7k↓27.3%1MITPHPPHP &gt;=8.3 &lt;8.6CI failing

Since Jan 5Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/byjg/php-sms-client)[ Packagist](https://packagist.org/packages/byjg/sms-client)[ GitHub Sponsors](https://github.com/byjg)[ RSS](/packages/byjg-sms-client/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

SMS Client
==========

[](#sms-client)

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/php-sms-client/actions/workflows/phpunit.yml/badge.svg?branch=main)](https://github.com/byjg/php-sms-client/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/php-sms-client/)[![GitHub license](https://camo.githubusercontent.com/2937d4c3c76c4b044ff573e2e44aaebc89008ae627edec6700ab7c9d7cecf44c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f7068702d736d732d636c69656e742e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/6fb7124b60e129cc9ad4420c5b5d4f06174532adb7c4f873ebd63771113b5914/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f7068702d736d732d636c69656e742e737667)](https://github.com/byjg/php-sms-client/releases/)

A lightweight, extensible PHP library for sending SMS messages through multiple providers.

Features
--------

[](#features)

- **Low code** - Simple, intuitive API for sending SMS
- **Provider agnostic** - Support for multiple SMS providers
- **Extensible** - Easy to implement custom providers
- **Phone formatting** - Built-in phone number validation and formatting
- **Multi-provider support** - Route messages to different providers based on country codes

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

[](#installation)

```
composer require byjg/sms-client
```

Quick Start
-----------

[](#quick-start)

```
use ByJG\SmsClient\Message;
use ByJG\SmsClient\Provider\ProviderFactory;
use ByJG\SmsClient\Provider\TwilioMessagingProvider;
use ByJG\Uri\Uri;

// Register and create provider
ProviderFactory::registerProvider(TwilioMessagingProvider::class);
$provider = ProviderFactory::create(new Uri("twilio://$accountSid:$authToken@default"));

// Send message
$response = $provider->send(
    "+12221234567",
    (new Message("Hello World!"))->withSender("+12223217654")
);

// Check result
if ($response->isSent()) {
    echo "Message sent successfully!";
}
```

Documentation
-------------

[](#documentation)

- [Basic Usage](docs/basic-usage.md) - Learn how to send SMS messages
- [Phone Formatting](docs/phone-formatting.md) - Phone number validation and formatting
- [Providers](docs/providers.md) - Available SMS providers and configuration
- [Custom Providers](docs/custom-providers.md) - Create your own SMS provider

Available Providers
-------------------

[](#available-providers)

ProviderURI SchemeDocumentationRegionTwilio Messaging`twilio://accountId:authToken@default`[Twilio SMS](https://www.twilio.com/en-us/messaging/channels/sms)GlobalTwilio Verify`twilio_verify://accountId:authToken@serviceSid`[Twilio Verify](https://www.twilio.com/en-us/trusted-activation/verify)GlobalByJG SMS`byjg://username:password@default`[ByJG](https://www.byjg.com.br/)BrazilFake Sender`fakesender://`Testing onlyTestingMulti-Provider Setup
--------------------

[](#multi-provider-setup)

Route messages to different providers based on country codes:

```
use ByJG\SmsClient\Provider\ProviderFactory;
use ByJG\SmsClient\Provider\TwilioMessagingProvider;
use ByJG\SmsClient\Provider\ByJGSmsProvider;
use ByJG\SmsClient\Message;

// Register providers
ProviderFactory::registerProvider(TwilioMessagingProvider::class);
ProviderFactory::registerProvider(ByJGSmsProvider::class);

// Associate with country codes
ProviderFactory::registerServices("twilio://accountId:authToken@default", "+1");
ProviderFactory::registerServices("byjg://username:password@default", "+55");

// Automatically routes to the right provider
ProviderFactory::createAndSend("+12221234567", new Message("Hello USA!"));
ProviderFactory::createAndSend("+5521987654321", new Message("Olá Brasil!"));
```

Phone Number Formatting
-----------------------

[](#phone-number-formatting)

Format and validate phone numbers with country-specific rules:

```
use ByJG\SmsClient\Phone;
use ByJG\SmsClient\PhoneFormat\USPhoneFormat;

$phone = Phone::phone("2345678900", new USPhoneFormat())
    ->withPlusPrefix()
    ->withCountryCode();

echo $phone->hydrate();  // Output: +12345678900
echo $phone->format();   // Output: +1(234)567-8900

// Validate phone numbers
$isValid = $phone->validate(throwException: false);
```

Dependencies
------------

[](#dependencies)

 ```
flowchart TD
    byjg/sms-client --> byjg/webrequest
```

      Loading ---

[Open source ByJG](http://opensource.byjg.com)

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance64

Regular maintenance activity

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

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

Every ~137 days

Recently: every ~98 days

Total

6

Last Release

221d ago

Major Versions

4.9.0 → 5.0.x-dev2024-10-27

5.0.1 → 6.0.02025-11-24

PHP version history (3 changes)4.9.0PHP &gt;=7.4.0

5.0.x-devPHP &gt;=8.1 &lt;8.4

6.0.0PHP &gt;=8.3 &lt;8.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/981924?v=4)[Joao Gilberto Magalhaes](/maintainers/byjg)[@byjg](https://github.com/byjg)

---

Top Contributors

[![byjg](https://avatars.githubusercontent.com/u/981924?v=4)](https://github.com/byjg "byjg (18 commits)")[![cdenadai](https://avatars.githubusercontent.com/u/51721735?v=4)](https://github.com/cdenadai "cdenadai (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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